Forums / General / Webshop - Send product properties

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

eZ debug

Timing: Jan 29 2025 13:42:20
Script start
Timing: Jan 29 2025 13:42:20
Module start 'content'
Timing: Jan 29 2025 13:42:20
Module end 'content'
Timing: Jan 29 2025 13:42:20
Script end

Main resources:

Total runtime0.1399 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.9219180.8438
Module start 'content' 0.00630.0051 768.7656101.9609
Module end 'content' 0.01150.1284 870.7266530.1719
Script end 0.1398  1,400.8984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00322.3107200.0002
Check MTime0.00130.9004200.0001
Mysql Total
Database connection0.00100.740510.0010
Mysqli_queries0.095768.39461410.0007
Looping result0.00100.71601390.0000
Template Total0.128091.510.1280
Template load0.00070.483910.0007
Template processing0.127491.042210.1274
Override
Cache load0.00040.320210.0004
Sytem overhead
Fetch class attribute can translate value0.00050.376710.0005
XML
Image XML parsing0.00020.150810.0002
General
dbfile0.00735.2398200.0004
String conversion0.00000.003730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs