
Originally Posted by
oavs
Sorry I'm bit not clear.
You mean;
1: To fix the CSS 'Add to Cart ' issue is to do with the javascript that commenting out of the box/or a section of code in the Attribute_grid file should be investigated. Is that right?
2: I should revert back to the original code as an better option where my current ammendments are at the moment that you have advised and implement the "includes/classes/observers/class.attributes_grid_products.php
modify the function updateNotifyAttributesModuleOptionBuilt to be the following adding the code in red:" alternative medthod?
Okay, I'll try to make this a comprehensive answer to minimize searching around further.
Item 1:
The initial "concern" was that the fact that the add-to-cart button remained displayed while the PAG options also displayed a quantity. In order to remove the text box of a product that had PAG applied, the following was incorporated:

Originally Posted by
oavs
Oh here is the content: zen-cart.com/showthread.php?85649-Product-Attribute-Grid&highlight=1188155
=========================
Quote Originally Posted by guyonthegoldcoast View Post
@ray-the-otter
I might have a solution for you that works for me.
I also had the same issue of confusion when I installed the module, so I made changes.
Template:
tpl_product_info_display.php ( copy to custom template folder, then make changes )
change :
Code:
if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<span class="fright">'.zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT).'</span>';
}
to this:
Code:
if ($zv_display_select_option > 0) {
// bof MOD: hide the quantity box if attributes exists // only works with Attribute Grid Module.
$the_button = '' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<span class="fright">'.zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT).'</span>'; // eof
} elseif ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<span class="fright">'.zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT).'</span>';
}
works for me for now, could be improved.
Any comments and changes please post them.
Regards
guyonthegoldcoast
==================================
I haven't had an opportunity to fully review your site, but you could confirm something for me which would make the following edit functional for your store.
Create a test product or modify one that doesn't use PAG so that the quantity order max is 1 or the quantity box status is 0. Verify that your CSS button still appears as desired. If it does, then the above code should be applied as shown below which is based off of a default version of the file, not as it has been modified in your store:
Find and change the following:
Code:
if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<span class="fright">'.zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT).'</span>';
}
to this:
Code:
if ($products_qty_box_status == 0 or $products_quantity_order_max== 1 or $zv_display_select_option > 0) { // bof MOD: hide the quantity box if attributes exists // only works with Attribute Grid Module.
// hide the quantity box and default to 1
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . '<span class="fright">'.zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT).'</span>';
}
If the above test is successful, then it would provide indication that your javascript is in fact looking for an input field with the name cart_quantity in order to modify the button because that is the only difference in the code originally added and this code.
Now, regarding item 2 (which was identified as an issue in the next quoted posted) and the primary point of my previous message.

Originally Posted by
oavs
Does anybody read this attribute grid posts? hope so :-)
I am using Attribute Grid plugin on my 1.5.5 Zencart. All working fine.
Since I want to use the attrib grid format for all my products including with only one single price option (to show layout and look uniform) , I have come across that if you do only have one grid option it is displaying and 'Option' (round) button without the quantity box. If I add another grid option then it display the both options as grid format with both showing quantity boxes.
What do I need to change in order to get using ONE Attribute Grid Option showing QUANTITY (with price option) box?
In order for PAG to display properly when only a single option value is presented (in the column, the row, or both) then the following edits are necessary and when PAG is updated here as a download, they will be incorporated. The difference in this and what has been discussed above is that the includes/modules/YOUR_TEMPLATE/attributes.php file does not need modification as suggested before and should be restored to permit it to handle the special case of $products_options->RecordCount() == 1.
So from the two posts "linked" here:

Originally Posted by
mc12345678
Found it.

Originally Posted by
mc12345678
BTW, found a better/improved solution to the single option value issue addressed above making the code removal/commenting out unnecessary.
The combined modification to make this all work out is:
Modification is needed to lines 285 and 314 of includes/classes/observers/class.attributes_grid_products.php
I will present each line and its modification as a group (285 orig, 285 mod then 314 same):
Line 285 from:
Code:
if (($grh_size > 1) && zen_not_null($grid_records['H']['options'][$grh]['name'])) {
To:
Code:
if (($grh_size >= 1) && zen_not_null($grid_records['H']['options'][$grh]['name'])) {
Line 314 from:
Code:
if (($grv_size > 1) && zen_not_null($grid_records['V']['options'][$grv]['name'])) {
To:
Code:
if (($grv_size >= 1) && zen_not_null($grid_records['V']['options'][$grv]['name'])) {
in includes/classes/observers/class.attributes_grid_products.php
modify the function updateNotifyAttributesModuleOptionBuilt to be the following adding the code in red (line numbers are not used here because of potential effects by applying the above):
Code:
function updateNotifyAttributesModuleOptionBuilt(&$callingClass, $notifier, $products_options_names_fields,
&$options_name, &$options_menu, &$options_comment,
&$options_comment_position, &$options_html_id,
&$options_attributes_image) {
global $products_options;
if ($products_options->RecordCount() == 1 && $products_options_names_fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_GRID) {
array_pop($options_name);
array_pop($options_menu);
array_pop($options_comment);
array_pop($options_comment_position);
array_pop($options_html_id);
array_pop($options_attributes_image);
$this->updateNotifyAttributesModuleDefaultSwitch($callingClass, $notifier, $products_options_names_fields, $options_name, $options_menu, $options_comment, $options_comment_position, $options_html_id);
}
// if at the last option name, then no further processing above and want to reset the
// counter so that on the next use on this session it is zero.
if ($this->_products_options_names_current == $this->_products_options_names_count) {
$this->_products_options_names_current = 0;
}
}
So, hopefully that clears things up for you (item 1) and everyone (item 2).
Bookmarks