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 15 2025 10:04:02
Script start
Timing: Jan 15 2025 10:04:02
Module start 'layout'
Timing: Jan 15 2025 10:04:02
Module start 'content'
Timing: Jan 15 2025 10:04:03
Module end 'content'
Timing: Jan 15 2025 10:04:03
Script end

Main resources:

Total runtime1.0605 sec
Peak memory usage6,144.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 685.6484183.6875
Module start 'layout' 0.00510.0028 869.335952.5625
Module start 'content' 0.00781.0510 921.89841,883.6484
Module end 'content' 1.05880.0017 2,805.5469136.5391
Script end 1.0605  2,942.0859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00580.5430160.0004
Check MTime0.00130.1197160.0001
Mysql Total
Database connection0.00070.067010.0007
Mysqli_queries0.984692.8431680.0145
Looping result0.00050.0484660.0000
Template Total1.012595.520.5062
Template load0.00440.416220.0022
Template processing1.008095.051720.5040
Template load and register function0.00130.123310.0013
states
state_id_array0.00130.120710.0013
state_identifier_array0.00190.179620.0010
Override
Cache load0.00410.3893460.0001
Sytem overhead
Fetch class attribute can translate value0.00060.052230.0002
Fetch class attribute name0.00180.173080.0002
XML
Image XML parsing0.00120.109730.0004
class_abstraction
Instantiating content class attribute0.00000.001390.0000
General
dbfile0.00720.6806230.0003
String conversion0.00000.000740.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