Zen Cart Logo
Forums / Basic Configuration / Show Product ID#

Show Product ID#

Locked

Views: 6,502

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
15 Feb 2009, 10:08 AM
#1
shuch3n avatar

shuch3n

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

16 Feb 2009, 12:06 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show Product ID#

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']

17 Feb 2009, 5:06 PM
#3
shuch3n avatar

shuch3n

New Zenner

Join Date:
Jan 2009
Posts:
7
Plugin Contributions:
0

Re: Show Product ID#

Thx you Ajeh!!! You rocks :P All your replys are very helpfull ^^

18 Feb 2009, 3:53 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show Product ID#

You are most welcome and thanks for posting the update that this worked for you ... :smile:

8 Jul 2009, 2:56 PM
#5
staceyx avatar

staceyx

New Zenner

Join Date:
May 2009
Posts:
28
Plugin Contributions:
0

Re: Show Product ID#

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!

10 Apr 2010, 11:02 PM
#6
amirgtr avatar

amirgtr

New Zenner

Join Date:
Mar 2009
Posts:
45
Plugin Contributions:
0

Re: Show Product ID#

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.

10 Apr 2010, 11:35 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show Product ID#

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'];
11 Oct 2010, 2:57 PM
#8
gomlers avatar

gomlers

Zen Follower

Join Date:
Aug 2008
Posts:
139
Plugin Contributions:
0

Re: Show Product ID#

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?
11 Oct 2010, 3:22 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show Product ID#

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']

11 Oct 2010, 3:34 PM
#10
gomlers avatar

gomlers

Zen Follower

Join Date:
Aug 2008
Posts:
139
Plugin Contributions:
0

Re: Show Product ID#

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?

14 Nov 2010, 4:21 AM
#11
hitch avatar

hitch

New Zenner

Join Date:
Sep 2006
Posts:
75
Plugin Contributions:
0

Re: Show Product ID#

Hey Ajeh,

How would you call that same info from a product listing page?

Cheers

14 Nov 2010, 7:40 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show Product ID#

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 ...