Post by Dudester » Thu Jan 23, 2020 11:25 am

Hi,
I am trying to modify products.tpl to display price/4 for a buy now pay later option, I am a noob at php and have used the following but it displays zero, any pointers what I am doing wrong?

<div>Four Fortnightly Payments of $<?php echo ($price / 4); ?></div>

Thanks

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by johnp » Thu Jan 23, 2020 5:31 pm

Save yourself the bother and put some money in a developer's pocket. :-)

https://www.opencart.com/index.php?rout ... er=WeDoWeb

https://www.opencart.com/index.php?rout ... n_id=29816

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD 2.6.1 lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by Dudester » Thu Jan 23, 2020 5:42 pm

johnp wrote:
Thu Jan 23, 2020 5:31 pm
Save yourself the bother and put some money in a developer's pocket. :-)
Yea, there's a reason I'm doing this myself, if I had the funds to pay for someone to do it I wouldnt be posting.
Just a simple division of the price is all I need...

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by johnp » Thu Jan 23, 2020 5:45 pm

If you don't have many products and want a quick fix why not add a custom field extension and add a line on each product page manually.

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD 2.6.1 lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by Dudester » Thu Jan 23, 2020 5:49 pm

johnp wrote:
Thu Jan 23, 2020 5:45 pm
If you don't have many products and want a quick fix why not add a custom field extension and add a line on each product page manually.
I have over 6000 products...

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by johnp » Thu Jan 23, 2020 5:51 pm

Ah. Ok. I'll try and take a look when I'm on my coffee break. Maybe one of the other guys can get you a faster answer. :)

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD 2.6.1 lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by Dudester » Thu Jan 23, 2020 6:12 pm

johnp wrote:
Thu Jan 23, 2020 5:51 pm
Ah. Ok. I'll try and take a look when I'm on my coffee break. Maybe one of the other guys can get you a faster answer. :)
It would be appreciated, dont understand why a simple division does not work in php or is $price not a numerical variable on products.tpl?

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by by mona » Thu Jan 23, 2020 6:42 pm

because you should be doing it in the controller !

and you have not posted your OC version .. so ..

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


Spinning Social : Links : Menus : Payments : Socials : Ads : Screen Backgrounds : Galleries : Headers : Banners : Promos


Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by Dudester » Thu Jan 23, 2020 7:02 pm

by mona wrote:
Thu Jan 23, 2020 6:42 pm
because you should be doing it in the controller !
and you have not posted your OC version .. so ..
I'm using Version 1.5.6.4
What exactly do we put in the controller?

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by by mona » Thu Jan 23, 2020 8:02 pm

well there are a variety of ways this could be done .. but you have not considered a few things that make this quite a lot of work ..
take a look at the catalog/controller/product/product.php file .. and then you have the accounts ..

so I was thinking about this ...
why not use the product options and divide it manually i.e. use the % ?
you might have to remove the + and - but that is MUCH easier .. just add a class .. and for those specific options you can hide the options price (because it will be a minus) .. and and the price into the option title .. something like that anyway ..

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


Spinning Social : Links : Menus : Payments : Socials : Ads : Screen Backgrounds : Galleries : Headers : Banners : Promos


Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by johnp » Thu Jan 23, 2020 8:44 pm

Ok. Try this. It may or may not work. A clever friend of mine suggested it:

<?php echo str_replace("£", "", $price) / 4 ; ?>

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD 2.6.1 lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by straightlight » Thu Jan 23, 2020 9:51 pm

Or:

Code: Select all

<?php echo str_replace("&euro;", "", $price) / 4 ; ?>
It has been known when using the original symbols it may not output accurately without using one of these range decimal codes: https://www.w3schools.com/charsets/ref_utf_currency.asp .

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member
Online

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Dudester » Fri Jan 24, 2020 4:54 am

by mona wrote:
Thu Jan 23, 2020 8:02 pm
well there are a variety of ways this could be done .. but you have not considered a few things that make this quite a lot of work ..
why not use the product options and divide it manually i.e. use the % ?
Hi,
Just to be clear, all I want to do is display the the price divided by 4 on the product page (I am modifying the cheque payment module), I dont want to actually change the checkout value.
There are various 'Buy Now Pay Later' vendors I am signing up with so i will have 3 or four of these all displaying different payment options (4 payments/5 payments/10 payments, etc) and the breakdown.
The actual transaction will be completed offline by contacting the buyer manually to obtain their app id.


Thanks for your time

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by Dudester » Fri Jan 24, 2020 5:06 am

johnp wrote:
Thu Jan 23, 2020 8:44 pm
Ok. Try this. It may or may not work. A clever friend of mine suggested it:
<?php echo str_replace("£", "", $price) / 4 ; ?>
THIS WORKS !!!
I had to replace the pound symbol for a dollar symbol and it works perfectly

Thank you for your help and thank you to everyone for their inputs.

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by johnp » Fri Jan 24, 2020 6:01 am

You're welcome. Where does the invoice get sent to? Lol. :)

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD 2.6.1 lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by Dudester » Fri Jan 24, 2020 6:17 am

johnp wrote:
Fri Jan 24, 2020 6:01 am
You're welcome. Where does the invoice get sent to? Lol. :)
Customer gets purchase email as normal.
Customers installs app on their phone or creates account online which generates an ID
We follow up with customer manually to obtain their app ID
We enter order details manually into 'Buy Now Pay Later' vendors online portal.
Transaction is completed between vendor and customer via the app.

I had to do it this way as none of the 'Pay Later'vendors provide modules for Opencart 1.5.x and upgrading mine is going to be a nightmare as I have so many add-ons and tweaks.

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by johnp » Fri Jan 24, 2020 6:23 am

Doh! I think you missed the joke. :)

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD 2.6.1 lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by Dudester » Fri Jan 24, 2020 7:03 am

johnp wrote:
Fri Jan 24, 2020 6:23 am
Doh! I think you missed the joke. :)
Haha, yep missed that, cheque's in the mail....

Newbie

Posts

Joined
Thu Jan 09, 2020 2:10 pm

Post by johnp » Fri Jan 24, 2020 6:00 pm

Dudester wrote:
Fri Jan 24, 2020 7:03 am
johnp wrote:
Fri Jan 24, 2020 6:23 am
Doh! I think you missed the joke. :)
Haha, yep missed that, cheque's in the mail....
Great stuff. I also take Cash, Bitcoin, Groats and turnips if the economy is really bad. :)

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD 2.6.1 lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK
Who is online

Users browsing this forum: No registered users and 5 guests