New Zenner
- Join Date:
- Jan 2009
- Posts:
- 7
- Plugin Contributions:
- 0
Show Product ID#
How to show Product ID# in Product Description?
I tried to change the tpl_product_info_display.php but it didn't seems to work :(
Thx
Shu
Views: 6,502
New Zenner
How to show Product ID# in Product Description?
I tried to change the tpl_product_info_display.php but it didn't seems to work :(
Thx
Shu
Oba-san
On the Product _info page the current products_id can be obtain with:
$_GET['products_id']
be aware that with attributes, if you need just the products_id you will want to use:
(int)$_GET['products_id']
New Zenner
Thx you Ajeh!!! You rocks :P All your replys are very helpfull ^^
Oba-san
You are most welcome and thanks for posting the update that this worked for you ... :smile:
New Zenner
Hi there, I'm sorry that I'm not following this - what I want is the product ID number listed with the product - and products sorted by the ID as well. I did read another post - that one was to set sort order in the back end - so what exactly do I do? (step by step) if possible? thank you!
New Zenner
Ajeh:
On the Product _info page the current products_id can be obtain with:
$_GET['products_id']be aware that with attributes, if you need just the products_id you will want to use:
(int)$_GET['products_id']
Can you write an example? That'd be awesome.
Oba-san
You need to be more specific what you are wanting to do ...
Just to show it on the products _info page you can use:
echo 'The Products ID# is: ' . (int)$_GET['products_id'];
Zen Follower
Hi Ajeh!
This post is almost what I'm looking for:
I want to check if the product I'm viewing, is in the shoppingcart as well, and if so: Display message.
Like this:
<?php if ($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) {
include("file.php");
print "<br />";
}
?>
This works just great with products without attributes. As soon as my product has attributes, this will never be true: $_SESSION['cart']->in_cart($_GET['products_id']) because the product in my cart has products_id of something like: ```
&products_id=557:8d5339e254cc2ffea8edb82e810f522f
Do you have any clue what to right in my if/else statement to check if the current product WITH attributes is in the cart?
Oba-san
This will never be true for Attributes as you are using:
$_SESSION['cart']->in_cart($_GET['products_id'])
1 $_GET['products_id'] is only valid on pages where $_GET['products_id'] exists
2 Products in the cart with attributes need the whole products_id:attributes but this only would exist in the $_GET['products_id'] if you come from the link in the shopping_cart
To know how many of a Product is in the shopping_cart regardless of the Attributes, you could use:
$_SESSION['cart']->in_cart_check('products_id', (int)$_GET['products_id'])
Now it does not matter how you get to the Product _info page and can still determine how many of a Product, regardless of attributes, are in the cart ...
If you are not on the Product _info page, then you need to just substitute the correct products_id variable to be checked for the:
(int)$_GET['products_id']
Zen Follower
Ajeh!
You are the woman!
Thank you - very helpful! It worked very nicely :)
FYI, I'm using it to include a file that shows my customers an addon-product, if the current product is in the cart.
I'm not sending the customer to the cart directly, I'm refreshing the product_info_display instead.
This way, my little "Cross-sale" module pops up at the top of the page as soon as the product they're viewing is in the cart.
Works pretty good.., and now it works better. Thank you again :D
EDIT: Hmm... for my use, the > if ($flag_show_product_info_in_cart_qty == 1 isn't really necessary is it?
New Zenner
Hey Ajeh,
How would you call that same info from a product listing page?
Cheers
Oba-san
You should be able to use the:
$listing->fields['products_id']
where you want to see it by adding it to the product_listing.php module ...
Tell staff why this post should be reviewed.