Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / How to modify my template to not show display-only attributes?

How to modify my template to not show display-only attributes?

Views: 3,409

Results 1 to 13 of 13
22 Apr 2012, 5:50 PM
#1
avaadorn avatar

avaadorn

Zen Follower

Join Date:
Feb 2012
Posts:
106
Plugin Contributions:
0

How to modify my template to not show display-only attributes?

I'm trying to get the Google Merchant Center Product Feed to work on my store. One of the tips the readme file says is:

"This module supports adding required fields as attributes to your products (you can set them to display only and then modify your template to not show display only attributes). Supported attributes are: Size, Color, Age Group, Gender, Material, Pattern, UPC, ISBN, EAN, and Google Product Category. Please use these exact names when creating your Option Names in Zen Cart."

My first question is on adding the attributes. In the Option Name Manger, I am just going to add all those attributes globally to all of my products and mark them as readonly attributes (Let me know if this is incorrect too). I don't know how to modify the template to not show display only attributes.

I also have the Stock By Attributes mod loaded, so I don't know if I should do what it says above. Because the readme also says:

"Alternatively, if you have Stock by Attributes (SBA) installed and you need for a single product to support multiple options (i.e. Small, Medium, Large, XL, XXL), create stock combinations in SBA and GMCF will automatically create variants for each stock combination"

I'm guessing I would modify the attributes.php file, but what code would I use? Has anyone done this already and is willing to share the code snippet?

Thanks!

24 Apr 2012, 3:36 PM
#2
avaadorn avatar

avaadorn

Zen Follower

Join Date:
Feb 2012
Posts:
106
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

Ok, I've figured out what some of this means now. So my only question that remains is how to modify your template to not show display only attributes.

Thanks.

30 Apr 2012, 10:51 AM
#3
mcgill avatar

mcgill

Zen Follower

Join Date:
Aug 2005
Posts:
101
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

Hi
did you ever figure this out? I'm stuck with this and cant find a solution. Can u help

30 Apr 2012, 2:01 PM
#4
avaadorn avatar

avaadorn

Zen Follower

Join Date:
Feb 2012
Posts:
106
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

McGill:

Hi
did you ever figure this out? I'm stuck with this and cant find a solution. Can u help

No, I am stuck as well. I am hoping one of the experts will reply to this thread. Or anyone who has ever done this will reply. Seems like anyone who has loaded the Google Merchant Center Product Feed add-on would want to do this. I'm thinking there is another add-on that loads the required Google attributes and maybe that add-on provides a way to make the attributes not display.

30 Apr 2012, 2:44 PM
#5
mcgill avatar

mcgill

Zen Follower

Join Date:
Aug 2005
Posts:
101
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

I found this but attributes.php is not in

/public_html/YOUR_CATALOG/
includes/modules/YOUR_TEMPLATE/attributes.php

ITS IN

/public_html/YOUR_CATALOG/
includes/modules/attributes.php

But not only that I cant find the code ANYWHERE in zencart :shocking:

Its a real mystery

One of the Guys here at Numinix (Ted) gave me these instructions, thanx must go to him not me remember, hope this helps as it worked a treat for me!


Ted @ Numinix ✆
25 Feb

to me 
Jonathan,

Thanks for your question. This file needs to be edited:

/public_html/YOUR_CATALOG/
includes/modules/YOUR_TEMPLATE/attributes.php

each query that selects data from the table TABLE_PRODUCTS_ATTRIBUTES needs to have the following condition

AND patrib.attributes_display_only = 0

Note, that on one of the queries, the table TABLE_PRODUCTS_ATTRIBUTES is referenced as pa so the condition would be

AND pa.attributes_display_only = 0JonnyRRR 
On The Path to Enlightenment
 
Posts: 4
Joined: Tue Feb 28, 2012 10:10 am
30 Apr 2012, 3:35 PM
#6
avaadorn avatar

avaadorn

Zen Follower

Join Date:
Feb 2012
Posts:
106
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

Thanks for that at least. I tried adding those 2 conditions in the code in attributes.php, but it didn't work for me. I am not a coder, so I don't even know if that's how it should be done. There must be something else to it. Did you get your Google Feed to work at least? Google doesn't seem to recognize some of my Read Only attributes.

30 Apr 2012, 4:23 PM
#7
mcgill avatar

mcgill

Zen Follower

Join Date:
Aug 2005
Posts:
101
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

AvaAdorn:

Thanks for that at least. I tried adding those 2 conditions in the code in attributes.php, but it didn't work for me. I am not a coder, so I don't even know if that's how it should be done. There must be something else to it. Did you get your Google Feed to work at least? Google doesn't seem to recognize some of my Read Only attributes.

Where was your attributes.php??????? The attributes.php I have does not have that code in ............. I am completely lost here. Yes I did get it working okay

30 Apr 2012, 5:47 PM
#8
avaadorn avatar

avaadorn

Zen Follower

Join Date:
Feb 2012
Posts:
106
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

I found the file right where you mentioned it would be:
/public_html/YOUR_CATALOG//includes/modules/attributes.php

Are you using Stock By Attributes? I am, and maybe that is why my Google Feed is not working correctly. I have found that if the readonly attributes are added before the SBA variant is added, it shows 0 stock. Weird.

I am completely lost too. We are both New Zenners trying to help each other out. Funny :) Need an expert.

30 Apr 2012, 6:02 PM
#9
mcgill avatar

mcgill

Zen Follower

Join Date:
Aug 2005
Posts:
101
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

No im not using it. I found my mistake. Got a bit confused. When you add the code it just blanks out the whole ad. My msql skills are not rusty they are completely corroded

30 Apr 2012, 6:26 PM
#10
avaadorn avatar

avaadorn

Zen Follower

Join Date:
Feb 2012
Posts:
106
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

When I add the code, it does nothing. Where are you adding the code? I added it in 3 places. I searched for TABLE_PRODUCTS_ATTRIBUTES, and then added the code underneath that.

30 Apr 2012, 6:32 PM
#11
mcgill avatar

mcgill

Zen Follower

Join Date:
Aug 2005
Posts:
101
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

AvaAdorn:

When I add the code, it does nothing. Where are you adding the code? I added it in 3 places. I searched for TABLE_PRODUCTS_ATTRIBUTES, and then added the code underneath that.

Yep thats right there are 3 places

I tried a few permutations but none worked

19 Jun 2014, 5:25 PM
#12
jtincher avatar

jtincher

New Zenner

Join Date:
Jun 2014
Location:
Close to Philadelphia, PA
Posts:
1
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

Just wanted to see if you guys ever found a solution to your question and not being able to "hide" the section when set to Display Only.

As the code from the ZenCart fellow mentioned, there are 3 places where you need to add in the mySQL line of code:

for each SQL query for TABLE_PRODUCTS_ATTRIBUTES you need to add:

and patrib.attributes_display_only = 0

$sql = "select count(*) as total
          from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
          where    patrib.products_id='" . (int)$_GET['products_id'] . "'
            and      patrib.options_id = popt.products_options_id
			[B]and	     patrib.attributes_display_only = 0[/B]
            and      popt.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
            " limit 1";
$sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
                              popt.products_options_type, popt.products_options_length, popt.products_options_comment,
                              popt.products_options_size,
                              popt.products_options_images_per_row,
                              popt.products_options_images_style,
                              popt.products_options_rows
              from        " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
              where           patrib.products_id='" . (int)$_GET['products_id'] . "'
              and             patrib.options_id = popt.products_options_id
	     [B] and             patrib.attributes_display_only = 0[/B]
              and             popt.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
              $options_order_by;

EXCEPT THERE IS ONE SQL QUERY that you need to slightly change the line that you add, use this on the 3rd change:

   $sql = "select    pov.products_options_values_id,
                        pov.products_options_values_name,
                        pa.*
              from      " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
              where     pa.products_id = '" . (int)$_GET['products_id'] . "'
              and       pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
              and       pa.options_values_id = pov.products_options_values_id
	      [B]and       pa.attributes_display_only = 0[/B]
              and       pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
                $order_by;
19 Jun 2014, 6:50 PM
#13
avaadorn avatar

avaadorn

Zen Follower

Join Date:
Feb 2012
Posts:
106
Plugin Contributions:
0

Re: How to modify my template to not show display-only attributes?

jtincher:

Just wanted to see if you guys ever found a solution to your question and not being able to "hide" the section when set to Display Only.

Thank you for submitting this code. It was helpful. However, I tried this and added the 3 lines of code exactly as you stated to my attributes.php file. My attributes that I set as Read Only still show up. Not sure what I am doing wrong.