Is their anyway of having a teaser view which still allows users to add products to their cart?
Im using this module to sell variety packs that each contain about 5 products (Ive set the default quantity to 1 not 0). I want to have a listings page that has all the variety packs where you can click on a pack for more information to go to its node page, or you can just click 'Add to cart' from the listings page.
Im assuming the only way to do this would be to get Views (or Panels, DS, etc) to recognize the Quantity and Add to Cart fields. How hard would this be to do?
On a bit of a tangent, if Views could use these fields it would give more layout control in general and you could use the Views Calc module to calculate total prices, weights, etc.
It would also allow me to set up my table and the fields for all 'parent product' types, rather than having to do it on a per node basis.
I hope im not being pushy and thanks a lot.
James
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | uc_products_custom.txt | 3.72 KB | kozubas |
Comments
Comment #1
larowlanYou can show the table in teaser view by going to /admin/content/node-type/PARENT-PRODUCT/display changing PARENT-PRODUCT to the appropriate content type you used for the parent product. Under the teaser column, choose UC Subproduct cart table as the display format.
Then you can create a view with row style of NODE (default is fields) and in the style settings (click the little gear) choose TEASER.
If you don't want to setup all of the fields for multiple nodes, you can look at the table uc_subproduct_display and copy the format of an existing one for other nodes, the table structure is basically:
id (auto increment id field)
vid (node vid)
nid (node nid)
title (the title of the column)
field (the field name - see the existing data in the table for expected formats)
weight (sort order of the field)
Comment #2
jdln commentedWhen you say 'table uc_subproduct_display', do you mean the table on individual parent-product node edit pages? How do I 'copy the format of an existing one for other nodes', do you mean manually add the same fields on each parent-product node edit page?
For the teaser view, If I want products to be able to be added to the cart then I have to choose the 'UC Sub-product add to cart form' display. This means I have to have the same display for the teaser and the full node.
I was hoping to have something briefer on the teaser view like;
'Multipack. 15 Items. £45. More Info. Add to cart'
And then on the product page I would have the full table display.
At the moment the only way I can think of doing this would be to create a product kit which contained the same products. I could link it with a node reference and then call its add to cart form on the teaser view.
Exposing the fields for your module to views would allow this to be done in a cleaner way, but im guessing that would be a lot of work?
Sorry for all the questions and thanks again.
Comment #3
larowlanHi
Table uc_subproduct_display is a database table, you will need to use sql to modify it.
You can get the add to cart feature from a teaser listing view with custom code to emulate what clicking on the 'add to cart' button does on the node view. To integrate this with views would require something like viewscustomfield and php to insert the form into each record.
I don't see any other way to do what you're trying to achieve without custom development/modules.
If you are php savvy, you could have a look at the function uc_subproduct_cart_table_form_submit that comes with the module as well as the way the nodes (items in the table) are collected in theme_uc_subproduct_formatter_cart_table_form. If you're not php savvy but are still interested in this kind of functionality, feel free to PM me and I'd be happy to quote on a custom module.
Lee
Comment #4
jdln commentedHi Lee. The coding stuff is beyond me at the moment. Im making this site as a side project so ill start by using the default functionality of the module and see how things go.
Thanks
Comment #5
kozubas commentedHere is my recept for modification of the uc_products view provided by Ubercart
1. Install http://drupal.org/project/views_customfield
2. Delete Product: Buy it now button field from the view
3. Add Customfield: PHP code field with value:
4. Enjoy
See exported view below.
Comment #6
kozubas commentedResulting view in attach. You can import it if you need.