Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / category_id when linked products

category_id when linked products

Locked

Views: 1,176

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
14 Aug 2009, 6:51 PM
#1
gomlers avatar

gomlers

Zen Follower

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

category_id when linked products

Hello

I have searched and searched, I can't find the answer, so sorry if this has been covered before..

I have recently added a new category, called "discontinued". All the products that are in here, are linked from the other categories.

In my product_info_display.php I have used
(zen_get_products_category_id($_GET['products_id']) == 34

to say that all products that are in category number 34 shall have some extra text, saying that this product is discontinued.

Problem is that when I link products from one category to another, the original category is beeing used. So my extra -discontinued-text- won't show.

I would really appreciate some help here..

You can see what I mean here:
Productinfo on product in discontinued-category:
http://www.tilbryllupet.no/restekurv-tilbud/2-stk-artige-vandrende-stearinlys-bla
(Notice the red text there)

Productinfo on product in a normal category:
http://www.tilbryllupet.no/bryllup-bordpynt/lysholdere-tilbehoer/vannperler

15 Aug 2009, 7:34 PM
#2
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: category_id when linked products

This would fix your problem but requires a little reversing..

Why dont you move all products to the discontinued category and then link them back to there original categories.

This would make you php code true and no further modification is needed.

User of zencart

15 Aug 2009, 7:36 PM
#3
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: category_id when linked products

Just a thought..

To make your original thought work you would need to check for all products that are linked to the discontinued category and then check the master category using mysql query to get you desired effect.

User of zencart

18 Aug 2009, 2:38 AM
#4
gomlers avatar

gomlers

Zen Follower

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

Re: category_id when linked products

batteryman:

This would fix your problem but requires a little reversing..

Why dont you move all products to the discontinued category and then link them back to there original categories.

This would make you php code true and no further modification is needed.

I would've thought so too.. but nope, that didn't work. The "old" category was the one beeing used when I did this... strange.. yes, true.. yes..

batteryman:

Just a thought..

To make your original thought work you would need to check for all products that are linked to the discontinued category and then check the master category using mysql query to get you desired effect.

YEP :) This DID work, I got a friend to establish the connection. Because of the classes, it was out of my league - but he made it. Now it works like a charm!

You can have a look here..
http://www.tilbryllupet.no/restekurv-tilbud

We used the master_categories_id to check if the product was attached to it, if so: Show my message - if not: Show original.. :D

Thanks for your answers though! Maybe this will help a searcher in the future..

If so, contact me, and I'd be glad to share the code :)

PS. We also changed the code, so that when customers try to add more in the shopping cart then actually in stock, they get a warning-message..
If the product is NOT in the discontinued category, they don't get message, and they can order more than we have in stock..

Very happy with it, and it has already made me money :)

18 Aug 2009, 4:53 PM
#5
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: category_id when linked products

Glad to hear it. Looks great...

I would look into a cross sell module to help you cross promote on each product page as well.

User of zencart