Jump to content

viewProd.inc.php


Guest

Recommended Posts

Hello all,

I'm wanting to put a bit of code in the viewProd.inc.php file so when the user is in a certain catagory they cannot see a bit of text written in the viewProd.tpl file.

Using say:

<!-- BEGIN: product_colour -->

text here

<!-- END: product_colour -->

How would i go about doing this, with the $view_prod->assign() assign, and a 'if' catagory equals 2 statement.

Can anyone help, i just don't seem to be able to quite do it.

Cheers Tim

Link to comment
Share on other sites

Guest PMinteractive

Hi

Can you post the sections of code you're trying to change here? Might help to see if there's an easy mistake someone can point out :D

Link to comment
Share on other sites

Hi

Can you post the sections of code you're trying to change here? Might help to see if there's an easy mistake someone can point out :)

Unfortunately i don't really know what im doing, so could do with some help in the coding.

I just assume it can be done in a similar way to all the other bits of code in the .tpl.inc files, using something like (but i REALLY don't know what im doing):

$view_prod->assign("COLOUR",$prodArray[0]['product_colour']);

if ($prodArray[0]['productId'] == 83){

$view_prod->assign("COLOUR",$lang['front']['viewProd']['product_colour']);

$view_prod->parse("view_prod.prod_true.product_colour");

}

else {

$view_prod->assign("COLOUR","");

}

EDIT :):o:o

I've somehow managed to get it to work for the product id of the two items :D using the code:

	$view_prod->assign("COLOUR",$prodArray[0]['product_colour']);

	

	if ($prodArray[0]['productId'] != 83 && $prodArray[0]['productId'] != 84 ){

		$view_prod->assign("COLOUR",$lang['front']['viewProd']['product_colour']);

		$view_prod->parse("view_prod.prod_true.product_colour");

	}

	

	else {

		$view_prod->assign("COLOUR","");

	}

However it would be better if i could hide the text based upon a catagory level rather than a specific product ID.

Any ideas ?

The main thing i suppose though is it seems to be working for me now.

Cheers Tim

EDIT AGAIN: infact im not even sure why this works, can anyone explain it to me.

Link to comment
Share on other sites

Guest PMinteractive

Morning,

Your code is almost there, you just need to change this line:

if ($prodArray[0]['productId'] != 83 && $prodArray[0]['productId'] != 84 )

	{




to this




if ($prodArray[0]['cat_id'] != 4) 

	{

where '4' is the category ID of products you don't want to assign the COLOUR variable for. However you seem to be assigning the variable COLOUR twice, your first line sets it to the product's colour, and the second time inside the IF statement sets it to the current language text for 'Product Colour'. Did you want the text or the colour displayed?

Link to comment
Share on other sites

Morning,

Your code is almost there, you just need to change this line:

if ($prodArray[0]['productId'] != 83 && $prodArray[0]['productId'] != 84 )

	{




to this




if ($prodArray[0]['cat_id'] != 4) 

	{

where '4' is the category ID of products you don't want to assign the COLOUR variable for. However you seem to be assigning the variable COLOUR twice, your first line sets it to the product's colour, and the second time inside the IF statement sets it to the current language text for 'Product Colour'. Did you want the text or the colour displayed?

Thanks, i just want to show and hide text based on that IF statement. What can i remove so im not assigning it twice.

Cheers Tim

Link to comment
Share on other sites

Guest PMinteractive

Ok, I think you need to remove the line above the IF statement but if that breaks it put it back, and then play with the assignment inside the IF statement :blink: A large chunk of the modifications I've made to my store are based on this highly scientific progamming method.

$view_prod->assign("COLOUR",$prodArray[0]['product_colour']);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...