Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Syntax to query unique product identifier?


Wetpants

Recommended Posts

Posted

Hello!

 

I'm making a change to the draw pull down menu in html_output.php but only want to do it if the product displayed in product_info.php is the right product.

Like:

 

if(product == "shoes") {

add_this_to_code;

}

 

I don't want it to do anything when the customer is looking at socks, just the shoes, but how do I make the code know to do it's thing in just the shoes section?

Posted

It seems like it might be easier to duplicate the function, with a new name. Then use your if statement where you need it...on the page in question. Product_info.php I guess.

 

Then something like this might work....

 

if ($current_category_id == 'the_cat_id_of_shoes') {

 

//use your new function

 

}else{

 

//use the other function, or do nothing, whichever you need.

 

}

 

Not sure but I think that may be a push in the right direction.

Posted

Thanks for the tip, I've been thinking about that too, and I think youre right.

 

But still, do you know if theres an already available variable to get that category id in product_info.php, I'm assuming that it's not so easy as $current_category_id. I thought I'd have to query the db or something. I see calls to the db but don't know which variable to use and don't know how I'd query the db if I had to do it myself.

Posted

$current_category_id should work.

 

You might add one line in product_info.php to try it out first...as a test.

 

<?php echo $current_category_id ?>

 

And then, I think I told you backwards. I think it's better to switch the id and variable around

 

if ('the_cat_id_of_shoes' == $current_category_id) {

 

//use your new function

 

}else{

 

//use the other function, or do nothing, whichever you need.

 

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...