Page 1 of 1

Products Module and Hierarchy ID

Posted: Sat Jan 15, 2011 6:40 pm
by kristy_lb
Hi everyone,
I recently updated to the latest edition of CMSMS and updated my Products module as well. Everything seemed to be working fine until I noticed that the product entries no longer produce a hierarchy_id. Is this a problem isolated to my installation, or is anyone else experiencing this? I had a script in place to display custom breadcrumbs based on hierarchy_id, and now none of my products have one so it isn't working. When I do a print_r for $entry, hierarchy_id is there as an available variable but it is empty. My hierarchies are set up properly, and have ID numbers. All my products have a hierarchy position selected.

Is there another variable I can use to access hierarchy id, name or position by entry?

Here is my version info:
CMS Version
1.9.2

Installed Modules
CMSMailer
2.0
FileManager
1.0.3
MenuManager
1.7.4
ModuleManager
1.4
News
2.11
nuSOAP
1.0.2
Printing
1.1.1
Search
1.6.8
ThemeManager
1.1.3
TinyMCE
2.8.2
FrontEndUsers
1.12.8
CGSimpleSmarty
1.4.7
CGExtensions
1.22.2
SelfRegistration
1.6.7
MyFavorites
1.0
Products
2.9.2
FormBuilder
0.6.4
CGBlog
1.7.1
CustomContent
1.7.3
CGFeedMaker
1.0.11
CGFeedback
1.2.1

running on Current PHP Version (phpversion): 5.2.14

Re: Products Module and Hierarchy ID

Posted: Mon Jan 17, 2011 1:39 am
by Sonya
kristy_lb wrote:until I noticed that the product entries no longer produce a hierarchy_id.
What view do you mean: summary or detail template?
kristy_lb wrote:I had a script in place to display custom breadcrumbs based on hierarchy_id, and now none of my products have one so it isn't working.
Please post the script here as it is impossible to say what is wrong in it without looking into it.
kristy_lb wrote:When I do a print_r for $entry, hierarchy_id is there as an available variable but it is empty.
I have a fresh install of
CMSMS 1.9.2
CGSimpleSmarty 1.4.7
CGExtensions 1.22.2
Products 2.9.2

and hierarchy_id is filled properly in summary and detail view.

Re: Products Module and Hierarchy ID

Posted: Mon Jan 17, 2011 3:09 am
by kristy_lb
Sonya wrote:
kristy_lb wrote:until I noticed that the product entries no longer produce a hierarchy_id.
What view do you mean: summary or detail template?
I didn't bother to test on the summary view until now. In the summary view it seems to produce the hierarchy_id, but still none in the detail view. Not sure why.
Sonya wrote:
kristy_lb wrote:I had a script in place to display custom breadcrumbs based on hierarchy_id, and now none of my products have one so it isn't working.
Please post the script here as it is impossible to say what is wrong in it without looking into it.
I don't imagine there's anything wrong with the script, it worked just fine before when $entry->hierarchy_id produced a value in the detail view, but here it is. I am using hierarchy instead of category as products can be in multiple categories.
{if $entry->hierarchy_id eq "7"}
{assign var='cat' value="Digital"}
{elseif $entry->hierarchy_id eq "8"}
{assign var='cat' value="Splatter"}
{elseif $entry->hierarchy_id eq "9"}
{assign var='cat' value="Fine Art"}
{elseif $entry->hierarchy_id eq "10"}
{assign var='cat' value="Floral"}
{elseif $entry->hierarchy_id eq "11"}
{assign var='cat' value="Grunge"}
{elseif $entry->hierarchy_id eq "12"}
{assign var='cat' value="Nature"}
{/if}
<p class="breadcrumbs"><a href="/">Home</a> > <a href="canvas-art-collections.html">Canvas Art Collections</a> > <a href='canvas-art-collections/{$cat}.html'>{$cat}</a> > {$entry->product_name}</p>
Sonya wrote:
kristy_lb wrote:When I do a print_r for $entry, hierarchy_id is there as an available variable but it is empty.
I have a fresh install of
CMSMS 1.9.2
CGSimpleSmarty 1.4.7
CGExtensions 1.22.2
Products 2.9.2

and hierarchy_id is filled properly in summary and detail view.
Well I guess it's a good thing it's an isolated problem, I probably have a better chance at fixing it then..

Thank you for your help!

Re: Products Module and Hierarchy ID

Posted: Mon Jan 17, 2011 3:26 am
by Sonya
kristy_lb wrote:I don't imagine there's anything wrong with the script, it worked just fine before when $entry->hierarchy_id produced a value in the detail view,
You are right. The script relies on $entry->hierarchy_id and if it is not there, then logically script does not work as desired. The issue is that $entry->hierarchy is empty. This variable is filled in modules/Products/action.default.php. Search for the line:

Code: Select all

$onerow->hierarchy_id = product_ops::get_product_hierarchy_id($row['id']);
and add below the line:

Code: Select all

print '<pre>';
print_r($onerow->hierarchy_id);
print '</pre>';
See your product detail view on the page. Can you see the $hierarchy_id outputted as a crappy list? ;) If no, than you have probably modified some files in the module Products? If yes, there is a possibility that this variable is overridden or emptied somewhere in your template before your custom breadcrumb script needs it.

Re: Products Module and Hierarchy ID

Posted: Fri Aug 19, 2011 3:59 pm
by djkirstyjay
I am having this problem since upgrading to CMSMS 1.9.4.2 "Faanui"

In debug mode I get this error :
Notice: Undefined variable: config in /home/1/s/sh/shb3_150/9plusonline.com/public_html/electric-installation-survey-inspection-law-tenerife/modules/Products/action.hierarchy.php on line 60

Notice: Undefined variable: id in /home/1/s/sh/shb3_150/9plusonline.com/public_html/electric-installation-survey-inspection-law-tenerife/modules/Products/action.hierarchy.php on line 80

Notice: Undefined variable: id in /home/1/s/sh/shb3_150/9plusonline.com/public_html/electric-installation-survey-inspection-law-tenerife/modules/Products/action.hierarchy.php on line 84
I have the following modules installed :

Album 0.9.3
Captcha 0.4.3
Cart 1.8.1
CGEcommerceBase 1.3.4
CGExtensions 1.26.6
CGSimpleSmarty 1.4.8
CMSMailer 2.0.1
CustomContent 1.7.3
FileManager 1.1.0
FormBuilder 0.7
FrontEndUsers 1.15
Guestbook 1.3.2
LightBox 1.0.1
MenuManager 1.7.6
ModuleManager 1.4.2
MysqlDump 1.2.3
News 2.11.3
NMS 2.3.2
NMSTrack 1.0
nuSOAP 1.0.2
Orders 1.13
Printing 1.1.2
Products 2.13.3
Search 1.6.10
SelfRegistration 1.6.12
ThemeManager 1.1.4
TinyMCE 2.8.4

Re: Products Module and Hierarchy ID

Posted: Fri Aug 19, 2011 4:06 pm
by kristy_lb
I was never able to get it to work properly so I ended up changing my script:
{if $entry->canonical|truncate:20:"" eq "art/details/Digital/"}
{assign var='cat' value="Digital"}

Re: Products Module and Hierarchy ID

Posted: Fri Aug 19, 2011 4:39 pm
by djkirstyjay
kristy_lb wrote:I was never able to get it to work properly so I ended up changing my script:
{if $entry->canonical|truncate:20:"" eq "art/details/Digital/"}
{assign var='cat' value="Digital"}
Sorry, I don't understand what this means...

What did you end up having to change and how did you change it to get the products to show again?

Re: Products Module and Hierarchy ID

Posted: Wed Aug 24, 2011 6:54 pm
by maranc
$entry->hierarchy_id return hierarchy id in array, not directly as hierarchy id value, so use foreach for get id.
Marek A.