Integration of Paypal Pay in 4 code in Hikashop eCommerce system

  • Posts: 22
  • Thank you received: 0
1 week 1 day ago #335641

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.8.13
-- PHP version -- : 5.6.40
-- Browser(s) name and version -- : Google Chrome

Hi Nicolas and the community,

I am wondering if it is possible to integrate Paypal's latest Buy Now Pay Later feature that pay in 4 instalments into Hikashop system?

PayPal Australia provided code and instructions to add into the Hikashop system.

Can anyone able to assist to see if this implementation can be feasible and done with the "Display Views" where we can put the following paypal code into the cart price" and dynamically add value on the price in the single item/cart view?

<!-- In your code, dynamically update
data-pp-amount with the price or cart amount.
For example, data-pp-amount=“89.99”
for $89.99 product
-->
<div
    data-pp-message
    data-pp-style-layout="text"
    data-pp-style-logo-type="inline"
    data-pp-style-text-color="black"
    data-pp-amount="ENTER_VALUE_HERE">
</div>

Thank you

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

  • Posts: 73730
  • Thank you received: 11306
  • MODERATOR
1 week 1 day ago #335650

Hi,

It sure can be done.
Note that as per developer.paypal.com/ppdevdocs/docs/busi...es/credit-messaging/ you also need the line:

<script src="https://www.paypal.com/sdk/js?client-id=YOUR-CLIENT-ID&components=messages"></script>
where you replace YOUR-CLIENT-ID by the client ID provided to you by PayPal.
Then, where to put it depends a bit on the situation.
You could place the code on the product page, so that instead of adding the product to the cart, the customer could click on that button to directly be redirected to PayPal for the payment of that one product. In that case, you could edit product / show_default.php and and the amount would be available with:
<?php echo round($this->element->prices[0]->price_value_with_tax, 2); ?>
Or you could edit checkout / show_block_cart.php to add the code on the cart view of the checkout. There, you could add such code:
<?php echo round($cart->full_total->prices[0]->price_value_with_tax, 2); ?>[/code]
Note that you can't put your code before the line:
$cart = $this->checkoutHelper->getCart();
since that line initializes $cart which you need for the amount.

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

  • Posts: 22
  • Thank you received: 0
3 days 7 hours ago #335801

Hi Nicolas,

Thanks for your reply and information provided.

I followed your suggestion and advice by inserting pieces of code to "show_block_cart.php" view under Checkout (under Display config) as shown in the attachments

1) Paypal messaging

<div
    data-pp-message
    data-pp-style-layout="text"
    data-pp-style-logo-type="inline"
    data-pp-style-text-color="black"
    data-pp-amount="<?php echo round($cart->full_total->prices[0]->price_value_with_tax, 2); ?>">
</div>

in Line 469 after hikashop_checkout_cart_final_total container

2) Paypal SDK head tag placed in the same show-block-cart view file in line 11.

After placing items on checkout and testing checkout, the final step of checkout did not show the Paypal Messaging that shows available to pay in 4 instalments.

I am not sure what went wrong as it did not work.

Our template framework uses Gantry5.

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

  • Posts: 73730
  • Thank you received: 11306
  • MODERATOR
2 days 11 hours ago #335809

Hi,

So I had a look on the link you gave in your first message, and I can see you're using HikaShop 4.0.0 there and not the 4.4.3 as you said in your first message.
Also, because of that, you have the setting "checkout legacy" in the HikaShop configuration. That setting has been removed since HikaShop 4.4.0.
And since you activated that setting, you are using the old checkout system of HikaShop, from HikaShop 1.x and 2.x.
The old checkout system of HikaShop doesn't use show_block_cart.php so that's normal that you didn't see any changes.

With the legacy checkout, you need to edit instead checkout / cart.php and instead of

<?php echo round($cart->full_total->prices[0]->price_value_with_tax, 2); ?>
you need to use:
<?php echo round($this->full_total->prices[0]->price_value_with_tax, 2); ?>

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

Time to create page: 0.060 seconds
Powered by Kunena Forum