Forums / Setup & design / custom workflow question

custom workflow question

Author Message

andre müller

Thursday 01 March 2007 6:46:37 am

on my product page i have to display prices from a remote database. to achive this, my only idea was to add a custom workflow that gets the price info before displaying the product. my question is: how does the collected pricing and availability information get from my workflow to the product page? help is greatly appreciated..

kracker (the)

Thursday 01 March 2007 7:04:12 am

As much as I think it would be a neat way to do that ... I don't think it's the right way for you to approach this offhand.

Why not simply use the wrap_operator to execute your remote call to your external price information via php and return the price value for that product to the template itself (as the wrap_operator is a flexible template operator).

Though a more complete solution may surround a custom copy of the shop module solely for your custom external price products (display) but ... again I think this too is a dead end.

I think the real solution is for you to learn how to sync your eZ publish product prices and external prices within eZ publish content objects in your content tree.

I would write a simple cronjob (which can be run like a shell script) which would perform this sync.

It is both predictable, repeatable and automated ;)

hth,
<i>//kracker

Michael W. Smith - My Place in This World</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

andre müller

Thursday 01 March 2007 7:16:38 am

thanks, kracker, for your helpful reply. until now, i followed your second proposal, not with a cronjob, but just with a script that went to all my products and grabbed the prices and entered them to the db. but that resulted in long script runtimes every day. but maybe i have to accept this. i like your first proposal though: i didn't know about the wrap operator and will definitely look into it.

Claudia Kosny

Thursday 01 March 2007 7:33:44 am

Hi there

I don't think that the wrap operator will help much. It might be possible to use it to display the price from a remote table in the template (although even then I don't not know how to do this with the wrap operator, unless kracker does not mean the same one I do).
But displaying the price in the template is not enough. You would also need to adapt the way the VAT is computed (as it needs to be based on your external price) and the way the basket works (as it fetches all prices on each basket update from the database again).

So I would recommend krackers second solution - it is fairly easy to do, reliable and if you run it at night, the run time of the script does not matter to much.
If you should need real time sync between your external table and the prices I would have a look at the ezpricetype::objectAttributeContent. Instead of fetching the data_float attribute you could fetch the price from your external db. Please note that I don't have the slightest clue whether this is feasible....

Good luck

Claudia

kracker (the)

Thursday 01 March 2007 7:56:40 am

@ Claudia

Agreed. 100%

Though one idea does strike me,
a custom class attribute datatype,
which provides for price, like ezprice,
which fetches price at the datatype,
when the addtobasket process
is being performed on a product
object, which in turn the datatype
provides the price as needed through
out the rest of the system.

In a more complete extension of this thought.

This might be an additional feature (for initial object
creation price or object price attribute usage),
keeping the syncPrices cronjob part (for updates).

<i>//kracker

Cypress Hill : KRoNnolog?k</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

andre müller

Thursday 01 March 2007 8:06:18 am

great ideas!
..now for my 'little problem' i forgot to mention that i have a custom basket & checkout functionality anyway, so no need for integrating prices in eZ shop functionality..(well it's all about using the amazon api). sorry for not mentioning..
i'll try to use the wrapper_operator extension by zurgutt (not the wrapper template operator!!)

eZ debug

Timing: Jan 18 2025 16:16:45
Script start
Timing: Jan 18 2025 16:16:45
Module start 'content'
Timing: Jan 18 2025 16:16:46
Module end 'content'
Timing: Jan 18 2025 16:16:46
Script end

Main resources:

Total runtime0.8834 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 588.8281180.8359
Module start 'content' 0.00730.7629 769.6641615.9609
Module end 'content' 0.77030.1131 1,385.6250337.0625
Script end 0.8834  1,722.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4502210.0002
Check MTime0.00150.1670210.0001
Mysql Total
Database connection0.00120.131410.0012
Mysqli_queries0.806791.30902050.0039
Looping result0.00200.23012030.0000
Template Total0.854096.720.4270
Template load0.00240.271620.0012
Template processing0.851596.389020.4258
Template load and register function0.00020.018110.0002
states
state_id_array0.00060.072510.0006
state_identifier_array0.00110.127420.0006
Override
Cache load0.00190.2203480.0000
Sytem overhead
Fetch class attribute can translate value0.00170.198140.0004
Fetch class attribute name0.00110.121770.0002
XML
Image XML parsing0.00140.161240.0004
class_abstraction
Instantiating content class attribute0.00000.002080.0000
General
dbfile0.00290.3329290.0001
String conversion0.00000.001030.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
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
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs