Monday 16 August 2010 12:07:28 pm - 2 replies
I know there are quite a few posts on this topic, but none seem to come to a conclusive conclusion.
I am developing a business to business webshop that supplies resellers. What I want to do is have all the products listed individually, but for a reseller to be able to select "sets" of products to add into their basket. For example, there would be a "starter pack" of products for a new reseller for their first order.
I can created a product, with a price, called starter pack, but if I do this I do not get visibility on the sales totals of the individual products in the pack, and if pricing of the products changes, I have to manually change the starter pack price.
I have looked at the old hack from Björn http://ez.no/community/contribs/h...ple_items_to_the_shop_basket_at_once but I cannot get this to relate to relate to 4.3 in any meaningful manner.
I have also seen suggestions along the lines of using Ajax to fill the shopping basket, but not sure how this would work.
I have got as far as creating a custom template for the started pack. In the template there will be a fetch that will get all of the products within the starter pack. So what I have is an array of all the products, where I am stuck, is how to get that array in the shopping basket in one click.
Can I loop through the array sending the products using AJAX xmlhttp.open and xmlhttp.send
Another option I have tried to explore is to create a reference order in the order list, but I can find no way of copying orders, or for customers to resubmit an order.
Any pointers would be gratefully received
Monday 16 August 2010 1:52:29 pm
Hi. I don't think there is a way to do that without doing your own extension. In our last project we've done something similar that could give you a hint on that.
In our case, we have some kinda product packs. For being brief, suppose our shop has 100 book references. one user could want to buy 12 of them.
For adding a product to your shop basket you will need at least a contentobject_id. but in our case, every book was a content object, so which one to add to the shop and how to calculate the total amount of the added pack?
knowing that a contentobject_id is required for being able to add something to your basket, we created a dummy product called something like 'Books Pack'. suppose that contentobject has id = 1000
instead of usign shop/add method to add it to the basket, we created our own module and added our add to basket stuff, trying always to use methods from ez publish kernel.
suppose then we have a page where 50 books are showed. user can add 10, 14, 20... whatever. every book has a checkbox with its contentobject_id as value. then we added the 'buy button' and that one will send selecteced contentobject ids to our 'add staff'.
in that add staff we check which products are the ones the user wants to add to the basket. knowing that products we can go through them, getting their prices and so we get the total amount of this pack. next you only need to add the product to the basket. following ez publish you can do something like
$item = eZProductCollectionItem::create( $basket->attribute( "productcollection_id" ) ); $item->setAttribute( 'name', 'Book Pack' ); $item->setAttribute( "contentobject_id", 1000 ); $item->setAttribute( "item_count", 1 ); $item->setAttribute( "price", $total ); // total price of the packet. sum of all selected by the user $item->setAttribute( "is_vat_inc", '0' ); $item->setAttribute( "vat_value", 4 ); $item->setAttribute( "discount", 0 ); // note that you can also use that for discount... $item->store();
Don't know if that could give you a hint. Not that this solution probably is not perfect... for example, what about adding two packs instead of only one... but that was not our customer requirement
You can also use that at a starting point for your stats. probably you can use an auxiliar table to save wich individual projects are being added in the product collection and when user completes the order do some stuff to increment the number of times that individual project has been sold.
But as said, i don't think ez publish could solve your needs by default. don't know if xrowcommerce extension could... i haven't play with it.
Monday 16 August 2010 2:38:39 pm
thanks for the tips, I was afraid a new module may the the answer. The site is already up and running, so xrowcommmerce is possibly too late, but I may do an install and see if its less pain migrating the site than writing custom stuff.
You must be logged in to post messages in this topic!