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.