Re: Product Attribute Grid
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?
Re: Product Attribute Grid
Absolutely is still read. Previous question regarding display of add-to-cart quantity was already addressed and could have been accomplished in other ways as well.
As to this issue, I've looked through the code and nothing stands out as the cause, but still need to try to replicate the issue.
If I understand correctly the setup is: product has a single option name and that option name has a single option value. The option name is setup to use the PAG option.
In the above configuration, you're saying that only a radio button is presented and not the PAG option.
Come to think of it, the way that the attributes.php file is setup, this seems like a ZC overrides the currently considered action situation. And the goal would be to override that "natural" action and allow operation to then continue back to show the PAG option.
For your store, could modify your includes/modules/YOUR_TEMPLATE/attributes.php and remove this entire section:
Code:
// dropdown menu auto switch to selected radio button display
case ($products_options->RecordCount() == 1):
if ($show_attributes_qty_prices_icon == 'true') {
$options_name[] = '<label class="switchedLabel ONE" for="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '">' . ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name'] . '</label>';
} else {
$options_name[] = $products_options_names->fields['products_options_name'];
}
$options_html_id[] = 'drprad-attrib-' . $products_options_names->fields['products_options_id'];
$options_menu[] = zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_value_id, 'selected', 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '"') . '<label class="attribsRadioButton" for="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '">' . $products_options_details . '</label>' . "\n";
$options_comment[] = $products_options_names->fields['products_options_comment'];
$options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
break;
At least until a more suitable standard solution is developed. It's a bit of a "hack", but would directly accomplish the desired task.
Ps. If there are hashtags (#) in the above, I apologize in advance. The content was directly copied from github and sometimes spaces turn into hashtags when I do that. I don't have an option to paste any special way at the moment to possibly remove and it would take a while to correct them after posting.
Re: Product Attribute Grid
Quote:
Originally Posted by
oavs
Hi Danny,
May I ask how you styled your Product Attribute Grid in
http://kitchenwarehouseltd.com/ ? did you do it your self or a developer did. I want to achieve the same look and feel in regards to Product Attribute Grid only.
Looking forward to your reply
Please ignore this.
Re: Product Attribute Grid
Hi, Thanks for your help it is much appreciated.
I have commented the as you advised. It worked but now it will not display product option value (under the heading of '
Product / Item Code') . You can see it here http://www.qbrands.com.au/qb/index.p...products_id=71
It supposed to display like this http://www.qbrands.com.au/qb/index.p...products_id=48
Re: Product Attribute Grid
Quote:
Originally Posted by
oavs
Found it.
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'])) {
On other things, while reviewing the source code, I noticed something that seemed odd but can be corrected through casting of variables that use the ['id'] key to an integer value. If one of those is blank (guess should/could really be 0) then ids such as: attrib-grid-vHeader- could be generated instead of attrib-grid-vHeader-0.
So for example line 315 would change from:
Code:
$this->_attrib_grid .= ' <td class="attrib-grid-vHeader" id="attrib-grid-vHeader-'.$grid_records['V']['options'][$grv]['id'].'">'.$grid_records['V']['options'][$grv]['name'];
to:
Code:
$this->_attrib_grid .= ' <td class="attrib-grid-vHeader" id="attrib-grid-vHeader-'.(int)$grid_records['V']['options'][$grv]['id'].'">'.$grid_records['V']['options'][$grv]['name'];
Not a huge deal unless you are using some sort of "calculation" code to relate to the specific id. The logical thing would be to look for one with the 0 in it, but that's not how it is currently functioning. Will get those two updated as time permits. :) Seems to work on my demo site. Welcome feedback on the two above solutions as in if issues are caused by them.
Re: Product Attribute Grid
Wow Iam speachless for the quality of support you are giving. Thanks a million.
Yes it works as you have ammended the code.
That is why I love Zencart, we get endless excellent SUPPORT SUPPORT SUPPORT from members and developes year in year out. Great bunch of guys and gals.
Cheers
Thanks you :-)
Re: Product Attribute Grid
sorry I was having network problem and posted twice.
Re: Product Attribute Grid
Ok one last thing.
I am tring to sytle the 'Add to Cart' button here http://www.qbrands.com.au/qb/index.p...r_of_uploads=0
to look and behave the same as here http://www.qbrands.com.au/qb/index.p...products_id=56
At the moment Attribute Grid seems to be using an image of 'Add to Cart' button instead of CSS.
Re: Product Attribute Grid
Quote:
Originally Posted by
oavs
Considering that the add to cart button of the unmodified product information page appears to be displayed using javascript and that the difference between the two page is the commenting out of the box/or a section of code, I would say that the commenting out portion should be reviewed as it applies to your store.
BTW, found a better/improved solution to the single option value issue addressed above making the code removal/commenting out unnecessary.
in includes/classes/observers/class.attributes_grid_products.php
modify the function updateNotifyAttributesModuleOptionBuilt to be the following adding the code in red:
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;
}
}
Re: Product Attribute Grid
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?