Webshop - Send product properties

Author Message

Vidry Jerome

Tuesday 12 January 2010 10:34:55 am

Hi,

I have a class product in ezPublish 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

Vidry Jerome

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!

"

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 ;)

"

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 eZ Publish 4.2).

"

I hope it will be useful for someone.

"

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

Nicolas Pastorino

Wednesday 13 January 2010 11:24:36 am

Oops, simultaneous answers with Zurgutt :)

--
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

Vidry Jerome

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 ?

Thanks

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:58:13
Script start
Timing: Jan 18 2025 02:58:13
Module start 'layout'
Timing: Jan 18 2025 02:58:13
Module start 'content'
Timing: Jan 18 2025 02:58:14
Module end 'content'
Timing: Jan 18 2025 02:58:14
Script end

Main resources:

Total runtime0.6505 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 592.2266152.6250
Module start 'layout' 0.00610.0031 744.851639.4453
Module start 'content' 0.00920.6399 784.2969619.6406
Module end 'content' 0.64910.0013 1,403.937516.1563
Script end 0.6504  1,420.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.5149160.0002
Check MTime0.00130.1939160.0001
Mysql Total
Database connection0.00080.122110.0008
Mysqli_queries0.590490.7730680.0087
Looping result0.00050.0832660.0000
Template Total0.617394.920.3086
Template load0.00190.288520.0009
Template processing0.615494.608820.3077
Template load and register function0.00010.018710.0001
states
state_id_array0.00140.216010.0014
state_identifier_array0.00090.134820.0004
Override
Cache load0.00170.2596460.0000
Sytem overhead
Fetch class attribute can translate value0.00050.072930.0002
Fetch class attribute name0.00100.153280.0001
XML
Image XML parsing0.00110.172530.0004
class_abstraction
Instantiating content class attribute0.00000.002290.0000
General
dbfile0.00150.2262230.0001
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs