- Posts: 48
- Thank you received: 0
Hikashop developing a payment plugin gateway
-- Joomla version -- : 3.3.1
-- PHP version -- : 5.4.43
-- Browser(s) name and version -- : MOZILLA FF 33.0.3
Developed a payment plugin based on ok payment plugin that came with the system.
It's for Tranzila gateway.
The thing is when a payment is successful order status doesn't get updated ,to confirmed.
When payment is bad the order does get cancelled ,only when good it's not confirmed.
The payment gateway send notify on both success and failure and I've built pages for both.
and on both pages I give order ID.(I give to gateway and gateway gives it back)
So I think if you explain to me the procedure how the order gets confirmed I would know where to try and debug.
Please Log in or Create an account to join the conversation.
Did you read the HikaShop sample payment plugin code ?
github.com/HikaShop/sample-payment-plugi...b/master/example.php
The confirmation of the order is made line 217 in that sample plugin
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.
Please Log in or Create an account to join the conversation.
$this->modifyOrder($order_id,$this->payment_params->verified_status,true,true);
didn't work ,so tried this
$this->modifyOrder($order_id,'confirmed',true,true);
also didn't work ,the order is still on status "created"
Please Log in or Create an account to join the conversation.
and cancelled status and so on!
I looked here:
hikashopPaymentPlugin
Please Log in or Create an account to join the conversation.
$this->payment_params->verified_status comes from your own payment plugin.
Normally, you have such attribute at the beginning of your payment plugin class:
'verified_status' => array('VERIFIED_STATUS', 'orderstatus')
which add the dropdown to select the status the merchant wants when a successful payment notification comes in.
The values of the options are then loaded by yourself in $this->payment_params at the beginning of the onPaymentNotification by calling the function $this->loadPaymentParams($dbOrder); as in the example payment plugin.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I think it is not being triggered at all !
It should be triggered both on payment success and failure ,right?!
I put this line of code inside it for debugging:
if($verified){ $this->modifyOrder($order_id,$this->payment_params->verified_status,true,true);mail("mymail@myurl.net", "verified", "ok");}
else mail("mymail@myurl.net", "verified", "bad");
I receive no mails at all ,although in other functions I do get mail.
Please Log in or Create an account to join the conversation.
function onAfterOrderConfirm(&$order,&$methods,$method_id){
is being called when user has pressed the finish button to move to payment gateway page(embedded iframe)
while this function
function onBeforeOrderConfirm(&$order)
is not being called at all ,which is kind of weird!
what's the usual scenario here ,if I may ask?
Please Log in or Create an account to join the conversation.
onPaymentNotification is called automatically when the payment gateway calls the notification URL of your payment plugin.
As you can see in the example plugin, the notification URL is:
The trigger onBeforeOrderConfirm doesn't exist so it's normal that the function is not called in your plugin.
Please Log in or Create an account to join the conversation.
What does this
index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=12&Itemid=12
trigger?
and what does this
index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id='.$order_id.$this->url_itemid;
trigger?
which functions are called?
Please Log in or Create an account to join the conversation.
The first one triggers nothing, it's just calling a view. The trigger called just before this is "onAfterOrderCreate(&$order,&$do)"
For the second one, the called trigger is "onBeforeOrderUpdate(&$order,&$do)"
Please Log in or Create an account to join the conversation.
I am a first timer with the whole Hikashop thing so I ask you to bear with me for I have a lot to ask about.
What is the function responsible for calculating final price and displaying it in checkout?
I need to make 25% off shipping price on second product for customers who order more than one product.
Where the highest shipping rate product will be the first.
So if a customer buys product A which ships for 40 and product B which ships for 80 ,then I will charge 80 for product B and only 30 for product A.which is 25% off. and so on if he orders 5 products he pays 100% for shipping only for the expensive one the rest he gets 75% price.
So to do this I need to know where the calculation is done and how!
Please Log in or Create an account to join the conversation.
The best would be to create a copy of the manual shipping plugin (so that you don't loose the modifications each time you update hikashop) and in that shipping, you can implement the onShippingDisplay function (see administrator/components/com_hikashop/helpers/helper.php for info on what this function contains).
In it, you can change the shipping price of the shipping methods on the fly and you also get in its parameters the content of the cart for your checks.
Please Log in or Create an account to join the conversation.
- A copy of manual shippment plugin you mean copy the files folder rename the folder and modify xml file and install with different name right?
- onShippingDisplay should be implemented inside manual class and parent::onShippingDisplay should be called from there as well?
- How do I get shipping cost for the product? both in onShippingDisplay and in my payment plugin?
I tried something like this:
foreach($order->cart->products as $product)
$ship_cost=$product->order_product_shipping_price;
it was a no go!
Please Log in or Create an account to join the conversation.
1. Yes, that's the idea of the copy.
2. Calling the parent::onShippingDisplay is interesting so you will have all features of the shipping interface. After the call, you can put some custom PHP code in order to add more filters (or new features) for the shipping methods.
3. The function onShippingDisplay gives you the cart with his products.
The product in the cart is not a "product", it's an "item". So you can access to the item custom field.
Bu you can read the product_id values of the products in the cart and load the products ; so you can access to the product custom field.
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.
Please Log in or Create an account to join the conversation.
Sorry for not being around so much.
I have tried the method you suggested ,I have the following in my manual.php file ,which I made sure is the one loaded by the system:
For example if a product costs 40 to ship ,and in my manual shipment I add this:
Please Log in or Create an account to join the conversation.
Your code doesn't makes sense.
In the function onShippingDisplay, you have these variables: &$order, &$dbrates, &$usable_rates, &$messages
There is no $ret, so I don't know what you're trying to do but either you have some other code you didn't provide or something else.
The goal of onShippingDisplay is to check all the shipping methods pertaining to the plugin in $dbrates and then to copy them in $usbale_rates. In the process of doing the copy, you can modify the price of the rate to whatever you want, but it's not in the $order that you should do that. It's in the rates that you copy from $dbrates to $usable_rates.
Please Log in or Create an account to join the conversation.
If I want to set the overall shipping price to 15, always simply 15 ,how do I do it!?
I tried it, and it had no effect on the shipping price.
and when I try this:
This is how I see $usable_rates:
Please Log in or Create an account to join the conversation.
I also need to display shipping price together with product price on price display .(list display)
how to do this?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.