Quantity selection matrix patch for Catalog 7.0.2

The following set of patches add the capability to build a matrix of quantity cells
where the entered values will be summed when adding to cart.  
The matrix is editable in the Cart and displayed on the checkout pages.
A list of the non-zero choices is passed to the customer e-mail, Orders and Reports.  

For example if you have a product that you wholesale in 5 sizes 
and 4 colours you could have a quantity matrix on the web-page:-

Colour/Size  S  M  L  XL XXL

   Red       0  0  0   0   0
  Green      0  0  0   0   0
  Blue       0  0  0   0   0
 Yellow      0  0  0   0   0 


Where the customer can enter whatever quantities they like in the "0" cells.
Additionally an optional running total row can be displayed.

To implement the above example all you need to do is in a Product's dialogue is 
to set the CUSTOMVARS:-

QTYCOLS to "Size,S,M,L,XL,XXL"
QTYROWS to "Colour,Red,Green,Blue,Yellow"

And select a Quantity Matrix product template, and that's that.


INSTALLATION

The .html, .css and .js files will work with any V7 version.  
The .pl and .pm files are for V7.0.1 ONLY.
Don't try to use them with other versions.

Copy the patch files (everything in this Zipfile) into Site1 
Back up the files that will be replaced first - these are:-

Act_ShoppingCartXML.html
ActinicOrder.pm
Cart.pm
CartManager.pl
ShoppingCart.pl

It might be a good idea to copy your entire Site1 folder somewhere safe just in case.


Go to do Design / Options / Layouts / Primary Templates
For each template listed (again, back them up first) click the Edit button and look for the line:- 

<SCRIPT LANGUAGE="JavaScript" SRC="actinicextras.js" TYPE="text/javascript"></SCRIPT>

Add the following 2 lines immediately below it

<SCRIPT LANGUAGE="JavaScript" SRC="quantitytablesupport.js" TYPE="text/javascript"></SCRIPT>
<LINK REL=STYLESHEET HREF="quantitytablesupport.css">

repeat for each template in  Design / Options / Layouts / Primary Templates.


Go to Advanced / Custom Properties and create 2 CUSTOMVARS called  QTYCOLS and QTYROWS.  

That's all patching done.   


OPERATION

To implement the above example all you need to do is in a Product's dialogue is 
to set the CUSTOMVARS:-

QTYCOLS to "Size,S,M,L,XL,XXL"
QTYROWS to "Colour,Red,Green,Blue,Yellow"

(if using Business make sure that "Use as Customvar" is checked and that "Searchable" is unchecked)

You can have any number of rows or columns but remember that it's all got to fit on the shopping cart
so you may want to use the smaller range (or smaller descriptions) for the Columns.

Select the section type as "Quantity on Product Page" (you can use Single Add to Cart if you wish)
and use QtyProductPageTable_ProductLine.html as the product (or section default) template. 
The matrix will be automagically generated for you and will be editable in the Shopping Cart.

Only the cells with non-zero quantities will be displayed in the customer e-mail 
and back office reports.


NOTES

If you wish to use this with your own product templates that's easy.   Just replace the 
fragment NETQUOTEVAR:PRODUCTQUANTITY in your template with the corresponding lump of 
code from QtyProductPageTable_ProductLine.html (the included comments explain what to use).

This does not attempt to implement any kind of stock control for each size, colour, etc.   
There is just a single product with a single stock level (which can be managed as usual)
and a lot of additional information defining what quantities of the combinations 
the customer has ordered. 

The file quantitytablesupport.css contains the styles used for the product matrix.
There are two sections, one for the product page and one for the shopping cart. 

An extra product template "QtyCartTable_ProductLine.html" is provided.  Use this 
if you want "Quantity in Shopping Cart" type pages.

The running total is optionally displayed at the bottom of the table.  
If you don't want this then
edit quantitymatrixsupport.js and change the line 

var showtotals = true;			// whether to show a running total on the product page

to be

var showtotals = false;			// whether to show a running total on the product page

I've not implemented this (yet - and may never) for "Quantity on Confirmation Page" sections. Don't use.


UNINSTALLATION

Restore the files you backed up:-

Act_ShoppingCartXML.html
ActinicOrder.pm
Cart.pm
CartManager.pl
ShoppingCart.pl

And undo (or restore from backups) the changes to the files in 
Design / Options / Layouts / Primary Templates.

Change any products that used template QtyProductPageTable_ProductLine.html back to normal ones.   


Norman Rouxel  rouxel@drillpine.biz

   




