Forums / General Questions / How to test if a product is linked to other categories?

How to test if a product is linked to other categories?

Locked

Views: 498

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
16 May 2010, 4:54 PM
#1
moosesoom avatar

moosesoom

New Zenner

Join Date:
Dec 2008
Location:
Rimini, Italy, Italy
Posts:
67
Plugin Contributions:
0

How to test if a product is linked to other categories?

Hi everybody,
in my shop, I have 2 sections:

  1. products I phisically have in stock (immediate shipping)
  2. products I can order from foreign distributor (about 1 month of waiting)

I've put whole distributor's catalog in the second section. Then I linked products I currently have to first section categories.

Now I'm testing in tpl_product_info.php if customer came to product from first (1) or second (2) section categories.

If (1) then I show "IMMEDIATE SHIPPING" near of product price.
else I show "product available in about one month"

That's right for customers browsing my shop, but not for ones coming from some search engine: if they land on a second section product actually present in first section too, they have to find the "IMMEDIATE SHIPPING" message.

So I have to test if the currently shown product is linked in two (or more) categories.

Is it possible (certainly yes)? How?

Thanks in advance
Francesco

17 May 2010, 7:38 AM
#2
moosesoom avatar

moosesoom

New Zenner

Join Date:
Dec 2008
Location:
Rimini, Italy, Italy
Posts:
67
Plugin Contributions:
0

Re: How to test if a product is linked to other categories?

moosesoom:

Now I'm testing in tpl_product_info.php if customer came to product from first (1) or second (2) section categories.

If (1) then I show "IMMEDIATE SHIPPING" near of product price.
else I show "product available in about one month"

I've duplicated admin function zen_get_product_is_linked to /includes/functions/extra_functions/functions_moosesoom.php

In tpl_product_info.php I changed my previous test to:

If (not (1) and zen_get_product_is_linked($_GET['products_id']) == 'false')) then I show "IMMEDIATE SHIPPING" near of product price.
else I show "product available in about one month"

DOUBT:

Now a little doubt about php expressions evaluating (:lookaroun): if conditions are read from left or right? I want zen_get_product_is_linked function called only if I'm not in second section categories.