Post by Dee87 » Thu Jan 13, 2022 5:31 pm

Good Day Everyone,
I hope ANYONE can help me with this (I am assuming easy) fix for implementing the code provided by Mobicred.
I have very basic knowledge on coding etc but not enough to help me with resolving this.

The Code provided by Mobicred:
To be added to either the header or footer:
<script src="https://app.mobicredwidget.co.za/assets ... "></script>
This I have done and seems to be working fine

To be added anywhere to display the widget on the website on the product page:
<div id="instalmentCalc" data-amount="1000"></div>
This works fine if you enter the data-amount in manually, it collects the installment info from the mobicred api and returns the correct installment

On their integration section they also provide the code below:
<div id="instalmentCalc"
data-amount= "<?php echo $price;?>"
data-before="Credit Amount:"
data-after="per month"
data-textColor="#666"
data-bgColor="transparent"
data-padding="0"
data-margin="5"
data-fontFamily="inherit"
data-fontSize="16"
data-fontWeight="normal"
data-merchantId="12345"
data-min="1"
data-max="20000">
</div>

Here is my issue
I want to use the last div code as this automatically gets the price from opencart.
However i cant seem to get the price from opencart correctly. I have tried multiple texts and formats but it does not pull the amount from opencart.

I am assuming that the code: <?php echo $price;?> is incorrect. I have tried option like "price" 'price' {{ "price" }} [ `price `] etc without any success.
When I try using $price then it displays an installment of R0.00 per Month.

Please don't laugh, like I said I have no clue what I am doing with my basic knowledge. and your help will be greatly appreciate.
I am sure this will be a stupid and easy fix, but I am too blind or uneducated to resolve this myself.

Attachments

Capture3.PNG

Widget added to header using custom html (working) - Capture3.PNG (15.51 KiB) Viewed 674 times

Capture2.PNG

product.twig theme editor code entered - Capture2.PNG (17.84 KiB) Viewed 674 times

Capture.PNG

Product page Widget Display - Capture.PNG (126.22 KiB) Viewed 674 times


Newbie

Posts

Joined
Thu Jan 13, 2022 5:09 pm

Post by xxvirusxx » Thu Jan 13, 2022 6:24 pm

Code: Select all

data-amount= "{{ price }}"
Also I think you need to register your website on that site
https://live.mobicred.co.za/web_mcrliv/run.w

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by cokesjo1 » Sun Nov 26, 2023 2:26 pm

Hi Guy where precisely do i insert the widget in the product.twig? :crazy:

Newbie

Posts

Joined
Sun Jan 03, 2021 5:10 am
Who is online

Users browsing this forum: No registered users and 4 guests