custom Cash On Delivery plugin

  • Posts: 120
  • Thank you received: 2
10 years 1 week ago #211092

-- HikaShop version -- : 2.x.x
-- Joomla version -- : 3

Hi Dear
I need developing custom Cash On Delivery plugin and I want get custom data from my customer and send data to my post system when submit orders.
Now in which method I can create my custom form and get my customer data?
I need create custom form in Cash On Delivery plugin without hack hikashop core I need only create custom Cash On Delivery plugin.
Thank you.

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
10 years 1 week ago #211095

Hi,

I would recommend that you look at either the purchase order payment plugin.
That will teach you how to collect data from the customer during the checkout when that payment method is selected, and how you can use it in the onBeforeOrderCreate trigger (and there you'll be able to add your code to send data to your post system).
Using that example, you should be able to easily develop you own custom cash on delivery plugin.

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

  • Posts: 120
  • Thank you received: 2
10 years 1 week ago #211108

Hi dear Nicolas
Thank you.
I need get customer data onAfterOrderCreate for example this code:

function onAfterOrderCreate(&$order) {

           echo '
                   <form action="" method="post">
                     <input type="hidden" value="'.$order->order_id.'" />
                      <select name="test">
                           <option value="1">value_1</option>
                           <option value="2">value_2</option>
                           <option value="3">value_3</option>
                      </select>
                    
                       <input type="submit" name="submit" value="send"/>
                    </form>
           ';
          
        }

but when submit this form show this message: The cart is empty
I can develop a custom component and send order data to it and get my customer data and use it but if I can use only hikashop plugin it's better. How can do it?
thank you

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
10 years 1 week ago #211118

Hi,

I would rather recommend to collect the data during the checkout like the purchase order plugin does.

Why not do it like I explained ?
Doing it only in the onAfterOrderCreate trigger like you did won't work since you didn't set any action to your form and thus your plugin is not called when you submit the form but the checkout of HikaShop is called, and since you have nothing in the cart anymore, you get redirected and see the "cart is empty" message.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum