Forums / General / Webshop - Send product properties
Vidry Jerome
Tuesday 12 January 2010 10:34:55 am
Hi,
I have a class product in Exponential which is linked to some other property classes (color, size...). To link the classes, I use objectrelations fields.
I want to be able to order a product using the webshop, precising what color and size I want.
For what I've seen, I can only set the quantity when I order a product.
Is there a way to add some fields to the product's description in the webshop on the client side and also in the admin ?
Thanks
Wednesday 13 January 2010 11:01:42 am
Well, after a few searches, I found a way to do that.
First, I added some Option attributes in my class Product ("sample_colors", "sample_sizes"). Then, in the cart's form I added some "attribute_view_gui attribute" to display some drop-down menus with the options I filled in the admin :
<form method="post" action={"content/action"|ezurl}> {attribute_view_gui attribute=$node.data_map.sample_colors} {attribute_view_gui attribute=$node.data_map.sample_sizes} <input type="submit" class="defaultbutton" name="ActionAddToBasket" value="{"Add to basket"|i18n("design/base")}" /> <input type="hidden" name="ContentNodeID" value="{$node.node_id}" /> <input type="hidden" name="ContentObjectID" value="{$node.object.id}" /> <input type="hidden" name="ViewMode" value="full" /></form>
Now, the options are added to the product when ordering and I can see them in the admin.
The last thing wrong now is the email sent, which doesn't include them. But I guess it's not a big deal. If someone knows how to do that, thanks ;)
I hope it will be useful for someone.
zurgutt -
Wednesday 13 January 2010 11:22:15 am
Have a look at order confirmation template for example, for code that displays order item options.
Certified eZ developer looking for projects. zurgutt at gg.ee
Nicolas Pastorino
Wednesday 13 January 2010 11:23:01 am
Good to see you found your way Jérôme!
You may want to have a look at the 'shop/orderemail.tpl' template. Not sure you are talking about the confirm-order-email though. If this is the case, you can create an override for the latter template, and do pretty much what you like in there (cf eZDefaultConfirmOrderHandler::sendOrderEmail in the file kernel/classes/confirmorderhandlers/ezdefaultconfirmorderhandler.php, l.67 in Exponential 4.2).
It definitely is, and thanks for sharing!
Cheers, -- Nicolas
-- Nicolas Pastorino Director Community - eZ Member of the Community Project Board eZ Publish Community on twitter: http://twitter.com/ezcommunity t : http://twitter.com/jeanvoye G+ : http://plus.tl/jeanvoye
Wednesday 13 January 2010 11:24:36 am
Oops, simultaneous answers with Zurgutt :)
Thursday 21 January 2010 10:26:42 am
Hi
Thanks for the answers. I could change the default behaviour creating an override of orderemail.tpl.
I was wondering, is there a way to send a differernt email to the admin ?