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

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 19:27:45
Script start
Timing: Jan 18 2025 19:27:45
Module start 'layout'
Timing: Jan 18 2025 19:27:45
Module start 'content'
Timing: Jan 18 2025 19:27:46
Module end 'content'
Timing: Jan 18 2025 19:27:46
Script end

Main resources:

Total runtime1.0727 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.0054 589.0313152.6250
Module start 'layout' 0.00540.0026 741.656339.4453
Module start 'content' 0.00801.0632 781.1016614.8828
Module end 'content' 1.07110.0015 1,395.984416.1641
Script end 1.0726  1,412.1484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3161160.0002
Check MTime0.00130.1230160.0001
Mysql Total
Database connection0.00080.078910.0008
Mysqli_queries1.011094.2526680.0149
Looping result0.00070.0642660.0000
Template Total1.042197.220.5211
Template load0.00210.191420.0010
Template processing1.040196.961320.5200
Template load and register function0.00030.026210.0003
states
state_id_array0.00100.090010.0010
state_identifier_array0.00090.086820.0005
Override
Cache load0.00170.1623480.0000
Sytem overhead
Fetch class attribute can translate value0.00070.069530.0002
Fetch class attribute name0.00120.113770.0002
XML
Image XML parsing0.00100.091530.0003
class_abstraction
Instantiating content class attribute0.00000.001780.0000
General
dbfile0.00080.0754180.0000
String conversion0.00000.000940.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
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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs