Site maintenance: Tuesday 17 Nov, from 10:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / All Other Contributions/Addons / Product Attribute Grid

Product Attribute Grid

Started by absolute on 15 Jan 2008, 5:01 PM · Views: 139,578

Results 81 to 100 of 546
16 Oct 2008, 12:40 PM
#81
alex_clarke avatar

alex_clarke

Totally Zenned

Join Date:
Mar 2006
Posts:
909
Plugin Contributions:
1

Product Attribute Grid

After several hours of troubleshooting, I've found this issue!

The latest SQL Injection patch (http://www.zen-cart.com/forum/showthread.php?t=108428) prevents this contribution from passing any data to the cart.

The contribution code probably needs to be re-written or modified to allow for the changes this patch makes.

So, we now know that anyone using this contribution on Zen Cart 1.3.8a is not patched! :blink:

I'll contact one of the Zen Cart team to find out if this is an issue with the contribution or the patch.

My Contributions: Zen Lightbox | Best Sellers Reloaded

16 Oct 2008, 5:30 PM
#82
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Product Attribute Grid

Are you actually using the updated version of the patch posted on Sept 23? The filename still reflects Sept 19, but the content of the file is different. If you're using the Sept 19 version of the file, you're going to have problems.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Oct 2008, 7:51 PM
#83
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,945
Plugin Contributions:
3

Re: Product Attribute Grid

k,

I installed the attributes grid contribution on a stock 1.3.8 install with the most up to date Security patch file.

It does in fact stop this contribution from adding items to the cart.

The reason is, that the security patch uses a whitelist of characters that are allowed in the to be keys of the products_id array.

The attribute grid contribution uses extended product ids, as keys and these fail the whitelist test.

The fix is fairly simple.

In the security patch, there is a function called.

securityPatchSanitizePostVariableProductsId

and in this is the line

if (ereg_replace('[0-9a-zA-z_]', '', $key) != '')

this should be changed to

if (ereg_replace('[0-9a-zA-z_:]', '', $key) != '')

We will look to release an updated patch (probably this weekend)

Our apologies for the inconvenience, however we took the position that using a whitelist was more secure than relying on a simple blacklist.

17 Oct 2008, 8:46 AM
#84
alex_clarke avatar

alex_clarke

Totally Zenned

Join Date:
Mar 2006
Posts:
909
Plugin Contributions:
1

Re: Product Attribute Grid

DrByte:

Are you actually using the updated version of the patch posted on Sept 23? The filename still reflects Sept 19, but the content of the file is different. If you're using the Sept 19 version of the file, you're going to have problems.

I was using the updated patch file.

However, wilt's fix above has sorted things. :smile:

Thanks for the fix wilt!

Also, thank you for taking the time to explain how the patch and contribution was conflicting.

My Contributions: Zen Lightbox | Best Sellers Reloaded

19 Oct 2008, 7:37 AM
#85
supersnow avatar

supersnow

Zen Follower

Join Date:
Apr 2007
Location:
California, USA
Posts:
233
Plugin Contributions:
0

Re: Product Attribute Grid

jacdesigner:

Supers have you by chance already tried the additional module for Attributes By Stock? I haven't been using it directly in conjunction with this grid module yet but I believe it will accomplish what your goal of hiding options that are unavailable.

I have the stock by attributes already installed (even prior to this module) and I wanted to know when the developer was going to release his update. He kinda mentioned earlier in the year about the integration of the stock by attributes and the product grid so to enable X in the grid as per his demo site. But the code and the update has never been posted (unless I am so blind that I have missed it).

Does anyone know how to exclude certain attribute combos from the add to cart by placing a x or image in the grid instead of a input box?

Thanks
Supersnow

15 Nov 2008, 7:40 PM
#86
rkuel avatar

rkuel

New Zenner

Join Date:
Nov 2008
Posts:
1
Plugin Contributions:
0

Re: Product Attribute Grid

I have installed this great add on.

I do have one question though, is there functionality built into this add on to allow more than two attributes (not a combo box or radio) not included in the grid?

For example, I have a grid of color and size, but I'd like to have a third checkbox not included in the grid.

The way it is now, when you add a third attribute it reverts back to the old style with radio buttons and no grid.

Thanks

5 Feb 2009, 4:33 PM
#87
joshuajao avatar

joshuajao

New Zenner

Join Date:
Apr 2008
Posts:
2
Plugin Contributions:
0

Re: Product Attribute Grid

I have installed this great add on and it works great. Thank you very much.

I just want to know how can I remove or change the width of the frame of the grid.

See the link http://www.jojopet.com/swalc0073-p-373.html

the frame or the border of the grid is not nice. Can anyone tell me how to change or remove it? thanks in advance.

Joshua

8 Feb 2009, 10:52 AM
#88
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

Re: Product Attribute Grid

rkuel - having a third option outside of the grid isn't an option at present, due to the way in which the module passes the data into the add to cart function, however, with a little tweaking, this would be possible.

In terms of replacing the input boxes with a red cross image or similar, you would need to have "Stock by Attribute" module installed, and then use the following code:

In includes/modules/attributes.php, the FOR statement found around line 136 should be replaced with the following:

	for($grh=0; $grh < $grh_size; $grh++) {
	  $attributes_ids = array(	$grid_records['H']['id']	=>	$grid_records['H']['options'][$grh]['id'],
	  							$grid_records['V']['id']	=>	$grid_records['V']['options'][$grv]['id']
							);
	  $products_attribs_id = zen_get_uprid((int)$_GET['products_id'], $attributes_ids);
	  $stock_check_array = array();
	  if (zen_not_null($grid_records['H']['options'][$grh]['name'])) $stock_check_array[] = $grid_records['H']['options'][$grh]['id'];
	  if (zen_not_null($grid_records['V']['options'][$grv]['name'])) $stock_check_array[] = $grid_records['V']['options'][$grv]['id'];
	  $attrib_grid .= '<td class="attrib-grid-cell" id="attrib-grid-cell-'.$grid_records['H']['options'][$grh]['id'].'-'.$grid_records['V']['options'][$grv]['id'].'">'.
                                              (zen_get_products_stock($_GET['products_id'], $stock_check_array) > 0 ?
	  					zen_draw_input_field('products_id['.$products_attribs_id.']', '', 'size="3"').
						zen_draw_hidden_field('attribs['.$products_attribs_id.']['.$grid_records['H']['id'].']', $grid_records['H']['options'][$grh]['id']).
						zen_draw_hidden_field('attribs['.$products_attribs_id.']['.$grid_records['V']['id'].']', $grid_records['V']['options'][$grv]['id'])
                                               : zen_image(DIR_WS_IMAGES.'item_out_stock.gif)).
					  '</td>';
	}

Hope this helps.

Absolute

Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store

11 Feb 2009, 7:58 PM
#89
charinlasvegas avatar

charinlasvegas

Zen Follower

Join Date:
Jan 2009
Location:
Vegas Baby!
Posts:
311
Plugin Contributions:
0

Re: Product Attribute Grid

Hi Absolute,

Here is a link to a product page using the attribute grid -- is there any way for me to have the "Size/Color" title show up at the top like "Quantity" instead of floating in the middle of the column?

BTW, this was the only way I could figure out how to have multiple sizes & colors with a qty box, if there's a better way I'd love to know what it is!

Completed: BellaFavori.com
In Progress: WeddingDivasLV.com
Coming Soon: ???

11 Feb 2009, 9:51 PM
#90
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

Re: Product Attribute Grid

Char - This whole module is designed as a grid, so along the top, you should have COLOUR, and down the side, you should have SIZE. Then you would end up with a 5 x 2 grid. To set this up, just setup 2 attributes - both RADIO fields. One is the SIZE, and the other is the COLOUR.

The rest is done for you.

As for moving the word SIZE to the top of the box, just add a tag to your stylesheet as follows:

#tab_attrib-grid-opt-nameV { vertical-align: top; }

That's it!

Absolute

Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store

11 Feb 2009, 10:45 PM
#91
charinlasvegas avatar

charinlasvegas

Zen Follower

Join Date:
Jan 2009
Location:
Vegas Baby!
Posts:
311
Plugin Contributions:
0

Re: Product Attribute Grid

Whenever I try to add more than one attribute with a qty box it all reverts to radio fields. Take a look here.

I added Color as a radio field the same way as adding the Qty radio, so it has a sort order of -9998. Then I added a separate drop down option name "colors" with option values "black" and "white". It's probably something I'm just missing in the way I'm doing it :dontgetit

Completed: BellaFavori.com
In Progress: WeddingDivasLV.com
Coming Soon: ???

12 Feb 2009, 7:07 AM
#92
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

Re: Product Attribute Grid

There you have 5 different attributes. You should only ever have TWO.

One attribute, set as a RADIO type should be colour, with RED, GREEN, BLUE etc as the VALUES.

The other should be SIZE with the VALUES XXL, XL, L, M, S

Thats all. Remove the other three attributes and it will work as expected.

You only need a quantity attribute if you only have 1 attribute, and want to force the single attribute into a grid format.

Absolute

Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store

12 Feb 2009, 3:04 PM
#93
charinlasvegas avatar

charinlasvegas

Zen Follower

Join Date:
Jan 2009
Location:
Vegas Baby!
Posts:
311
Plugin Contributions:
0

Re: Product Attribute Grid

Ooooh :blush: Ok I got it now & that worked, thank you!

Completed: BellaFavori.com
In Progress: WeddingDivasLV.com
Coming Soon: ???

12 Feb 2009, 9:00 PM
#94
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

Re: Product Attribute Grid

No problem.

Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store

16 Mar 2009, 9:44 PM
#95
ivogue avatar

ivogue

New Zenner

Join Date:
Nov 2008
Posts:
16
Plugin Contributions:
0

Re: Product Attribute Grid

Absolute, sorry to bother you. Is there a way to have the price in it's own column.

Like

[attribute] [price] [qty box]

??

Thank you!

18 Mar 2009, 12:14 PM
#96
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

Re: Product Attribute Grid

You can. However, this is a little beyond the scope of this module. The existing could certainly be updated to reflect any setup/layout you are looking for.

Absolute

Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store

29 Mar 2009, 7:30 AM
#97
supersnow avatar

supersnow

Zen Follower

Join Date:
Apr 2007
Location:
California, USA
Posts:
233
Plugin Contributions:
0

Re: Product Attribute Grid

Absolute:

In terms of replacing the input boxes with a red cross image or similar, you would need to have "Stock by Attribute" module installed, and then use the following code:

In includes/modules/attributes.php, the FOR statement found around line 136 should be replaced with the following:

for($grh=0; $grh < $grh_size; $grh++) {
  $attributes_ids = array(    $grid_records['H']['id']    =>    $grid_records['H']['options'][$grh]['id'],
                              $grid_records['V']['id']    =>    $grid_records['V']['options'][$grv]['id']
                        );
  $products_attribs_id = zen_get_uprid((int)$_GET['products_id'], $attributes_ids);
  $stock_check_array = array();
  if (zen_not_null($grid_records['H']['options'][$grh]['name'])) $stock_check_array[] = $grid_records['H']['options'][$grh]['id'];
  if (zen_not_null($grid_records['V']['options'][$grv]['name'])) $stock_check_array[] = $grid_records['V']['options'][$grv]['id'];
  $attrib_grid .= '<td class="attrib-grid-cell" id="attrib-grid-cell-'.$grid_records['H']['options'][$grh]['id'].'-'.$grid_records['V']['options'][$grv]['id'].'">'.
                                          (zen_get_products_stock($_GET['products_id'], $stock_check_array) > 0 ?
                      zen_draw_input_field('products_id['.$products_attribs_id.']', '', 'size="3"').
                    zen_draw_hidden_field('attribs['.$products_attribs_id.']['.$grid_records['H']['id'].']', $grid_records['H']['options'][$grh]['id']).
                    zen_draw_hidden_field('attribs['.$products_attribs_id.']['.$grid_records['V']['id'].']', $grid_records['V']['options'][$grv]['id'])
                                           : zen_image(DIR_WS_IMAGES.'item_out_stock.gif)).
                  '</td>';
}
> 
> Absolute

Yes I do have the stock by attributes installed and your fix worked. But there was one small error in the code it was missing a '. So for anyone else wanting this to little fix to work:

In includes/modules/attributes.php (or if you are like me that uses the template override system includes/modules/YOUR_TEMPLATE/attributes.php)
**Find**:

for($grh=0; $grh < $grh_size; $grh++) {
$attributes_ids = array( $grid_records['H']['id'] => $grid_records['H']['options'][$grh]['id'],
$grid_records['V']['id'] => $grid_records['V']['options'][$grv]['id']
);
$products_attribs_id = zen_get_uprid((int)$_GET['products_id'], $attributes_ids);
$attrib_grid .= '<td class="attrib-grid-cell" id="attrib-grid-cell-'.$grid_records['H']['options'][$grh]['id'].'-'.$grid_records['V']['options'][$grv]['id'].'">'.
zen_draw_input_field('products_id['.$products_attribs_id.']', '', 'size="3"').'<br />'.
zen_draw_hidden_field('attribs['.$products_attribs_id.']['.$grid_records['H']['id'].']', $grid_records['H']['options'][$grh]['id']).
zen_draw_hidden_field('attribs['.$products_attribs_id.']['.$grid_records['V']['id'].']', $grid_records['V']['options'][$grv]['id']).
'</td>';
}

for($grh=0; $grh < $grh_size; $grh++) {
$attributes_ids = array( $grid_records['H']['id'] => $grid_records['H']['options'][$grh]['id'],
$grid_records['V']['id'] => $grid_records['V']['options'][$grv]['id']
);
$products_attribs_id = zen_get_uprid((int)$_GET['products_id'], $attributes_ids);
$stock_check_array = array();
if (zen_not_null($grid_records['H']['options'][$grh]['name'])) $stock_check_array[] = $grid_records['H']['options'][$grh]['id'];
if (zen_not_null($grid_records['V']['options'][$grv]['name'])) $stock_check_array[] = $grid_records['V']['options'][$grv]['id'];
$attrib_grid .= '<td class="attrib-grid-cell" id="attrib-grid-cell-'.$grid_records['H']['options'][$grh]['id'].'-'.$grid_records['V']['options'][$grv]['id'].'">'.
(zen_get_products_stock($_GET['products_id'], $stock_check_array) > 0 ?
zen_draw_input_field('products_id['.$products_attribs_id.']', '', 'size="3"').
zen_draw_hidden_field('attribs['.$products_attribs_id.']['.$grid_records['H']['id'].']', $grid_records['H']['options'][$grh]['id']).
zen_draw_hidden_field('attribs['.$products_attribs_id.']['.$grid_records['V']['id'].']', $grid_records['V']['options'][$grv]['id']).
:zen_image(DIR_WS_IMAGES.'item_out_stock.gif')).
'</td>';
}

We just used a similar X like on Absoulte's website.

Thanks again to Absolute for a great module and  very simple fix.

Thanks
Supersnow

10 Apr 2009, 4:01 AM
#98
supersnow avatar

supersnow

Zen Follower

Join Date:
Apr 2007
Location:
California, USA
Posts:
233
Plugin Contributions:
0

Re: Product Attribute Grid

The code above works great for two option attributes. But if I use it the grid for single attributes, and still want to have all options with a Quantity box next to them then I have a problem.

I have followed the readme and set up an attribute called Quantity, which is a Radio type option and then setup one option value, which has no text defined, so it is just a completely blank value, but then even with stock by attribute setup normally I get my X image in all the boxes. But if I put text in the option value the quantity box appears for each single attribute again.

So what do I need to do with this code so it still works with single attributes?

Thanks
Supersnow

13 Apr 2009, 7:29 PM
#99
flowerchild5 avatar

flowerchild5

New Zenner

Join Date:
Mar 2009
Posts:
31
Plugin Contributions:
0

Re: Product Attribute Grid

Does anyone think (or know) that this mod could be combined with the "drop down attributes at product listing mod", so that I could create a "quick order on steroids". The grid format would be on the product listing page rather than product info. That way a customer could order for example 5 of one size of shoe and 10 of another size of product a then order 20 of one size and 30 of another of product b on the same page.

I tried combining the 2 modules on my test site with no success. Probably because of my lack of php knowledge.

15 Apr 2009, 11:32 AM
#100
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

Re: Product Attribute Grid

The two modules would not function together, as the module we have created relies on a number of product specific hidden variables when the form is submitted.

The solution to the problem you are looking to solve has been created already however! We have it running on a couple of our sites. If you want a pointer in the right direction, you would need to update your cart action script to add the items to cart with attributes, and then on your product listing page, show all the product attributes with speific field names.

It can be done, but requires a little PHP knowledge.

Absolute

Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store