creating additional files in the ordering process

  • Posts: 16
  • Thank you received: 0
12 years 2 weeks ago #73430

Hey,

I am very new to HikaShop and it seems to be a great Extension. But i have several questions about it and i hope someone can help.

First Problem:
We have a website (local for the moment) and we want to create some additional files when a customer has ordered a product.
We already have php code for creating a PDF via the tcpdf class and also there is some code for an xml file with order informations.
My question is: Is it possible to intigrate the code into the ordering process of HikaShop?

Second Problem:
If the first problem is solved, is it possible to read the variables from the product options? Because we need them as variables for the PDF and xml files. For example: Our product has an option for the color and we want to use that in our xml file.

It would be great if anyone can help us solving our problems.
Thank you,

Moritz.

Please Log in or Create an account to join the conversation.

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
12 years 2 weeks ago #73488

Hi,

You can override a lot of things in HikaShop and you can do much more thanks plugins.
For example, there is a trigger called "onBeforeDownloadFile" which took three parameters : &$filename, &$do, &$file.
First is the filename of what the customer wants to download (could be a relative path, a url or a string which begins with an @).
Second is a boolean value. If false, the download process would be canceled.
The last one is an object, the object is mainly the result of a database request on the table "file".
In the latest version of HikaShop (2.0, still in beta for the moment), you would have access to more data, like the "order_id".

So you would be able to create an HikaShop plugin which would contains this function (this trigger) and thanks to it, you could dynamically change the filename of the file that HikaShop would send to the user.

Thanks to the order_id and the product_id, you would be able to retrieve all you needs (Using orderClass::loadFullOrder for example).

Best regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: mobe84

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 0
12 years 2 weeks ago #73534

Thank you for your reply.

I think these triggers seem to be exactly what i was looking for!

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 0
12 years 1 week ago #74305

Hi,

i am currently playing around with the triggers. I created a small plugin for displaying some informations about the order. For that i use the onAfterOrderCreate() function and everything is running good so far.
But i have one small problem: When i try to read the value for my "order_product_options" and display it i only got some crazy coded text ;)
Is there a way to get the selected options for an ordered product within a string or an array?
Currently i use

$selected_options = $my_product->order_product_options;

which returns the text from the database. I am looking for a function to get the values the customer selected without having to encode it from the database text.

Please Log in or Create an account to join the conversation.

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
12 years 1 week ago #74309

Hi,

order_product_options is a serialized field.
You have to load it like this:

if(is_string($selected_options)) { $selected_options = unserialize($selected_options); }

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: mobe84

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 0
12 years 1 week ago #74338

works perfect! thank you again :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum