Post by timkirtley » Mon Nov 08, 2010 8:07 pm

Hi.

Couldn't really fit in a descriptive title, so here goes:


Basically, I would like to be able to run a specific bit of code upon order completion, depending on the product purchased, as the code is not applicable to all products..


Does something like that sound possible? Some sort of conditional statement according to whether a product is in a certain category?


Thanks in advance for any help.

New member

Posts

Joined
Fri Jun 04, 2010 7:01 am

Post by kedgetech » Tue Nov 09, 2010 9:32 am

timkirtley wrote: Basically, I would like to be able to run a specific bit of code upon order completion, depending on the product purchased, as the code is not applicable to all products..
Does something like that sound possible? Some sort of conditional statement according to whether a product is in a certain category?
You can be able to update the product module to have a flag (checkbox) to run your piece of code. More in the lines of our module Per-product-fee (http://www.kedgegroup.com/store/OpenCar ... Fee_Module). Should not be that difficuilt i suppose. I believe you may have more control on the product level compared to category.

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by timkirtley » Wed Nov 10, 2010 7:19 pm

Hi,

Thanks for your reply.

How exactly would the approach you mention work? You would add a custom variable to the required products - how would the code that completes an order be able to pick up on that flag/variable?

New member

Posts

Joined
Fri Jun 04, 2010 7:01 am

Post by kedgetech » Thu Nov 11, 2010 6:17 pm

timkirtley wrote:How exactly would the approach you mention work? You would add a custom variable to the required products - how would the code that completes an order be able to pick up on that flag/variable?
Not sure I understand your question. "How would the code that completes and order" - Are you saying your code completes the order not the opencart?

I would say based on the flag you have to run the code some where during the checkout process, you can get the variables from the cart. Care to mention whats the code you want to run ?

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by timkirtley » Thu Nov 11, 2010 6:42 pm

Okay sorry, to clarify:

No there's no special code completing the order, I mean the Opencart code that completes the order - adds it the db, sends confirmation emails, displays success message.


Basically, some products when purchased need to be automatically registered for a Warranty, some but not all products.

The code to register for a warranty, simply adds the details to a newsletter mailing list, its about 15 lines of php.

I need to be able to run this code when a successful order goes through for an applicable product.

New member

Posts

Joined
Fri Jun 04, 2010 7:01 am

Post by kedgetech » Fri Nov 12, 2010 6:13 am

You should hunt down the code that triggers after the sucessful order and add the code there. You can check the products in the cart and based on condition that the flag we discussed exists manuplate the code to run or no-run

Hope that helps

Cheers.

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India
Who is online

Users browsing this forum: No registered users and 4 guests