Post by enolia » Mon Mar 28, 2022 9:02 pm

Hello,
I'm posting this message because I hope to find some help.

I created a site using Opencart. I had managed to modify the files in order to modify the "add to cart" button to "
quote request" when the price of the item is 0.
However during the last update everything was erased. Do you know why this happened and how to prevent it from happening again?
Thank you in advance for your answers

Newbie

Posts

Joined
Mon Mar 21, 2022 4:44 pm

Post by straightlight » Mon Mar 28, 2022 9:24 pm

OC version. More info.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by enolia » Mon Mar 28, 2022 10:06 pm

We are in 3.0 version

Newbie

Posts

Joined
Mon Mar 21, 2022 4:44 pm

Post by Gergely » Mon Mar 28, 2022 10:56 pm

enolia wrote:
Mon Mar 28, 2022 9:02 pm
Hello,
I'm posting this message because I hope to find some help.

I created a site using Opencart. I had managed to modify the files in order to modify the "add to cart" button to "
quote request" when the price of the item is 0.
However during the last update everything was erased. Do you know why this happened and how to prevent it from happening again?
Thank you in advance for your answers
Yes, definitely: this happened because your modification method was not compatible with the method you chose for updating. To prevent something like this happening again, use the recommended modification system (viewtopic.php?f=144&t=227710) and make sure to do regular backups, especially before updating. You could also set up a staging environment for testing purposes.

If you would like to receive more specific help, it would be necessary to include more information:
  1. What exactly you are trying to achieve - you covered this: change Add to Cart button text for zero priced items
  2. What you have already tried - the methods you have used to carry out the edits
  3. What you expected to happen - this is implied, I guess: that your edits would survive an update(?)
  4. What happened (A precise description + screenshots + error logs if possible) - How did you update your site? why? did you do a backup? etc...
  5. Any additional info you already know about the problem
  6. Any troubleshooting attempts you have already tried
In general, please read this topic in the Forum Rules and adjust your request accordingly.

Depending on the above info it might or might not be possible to recover your modifications. It might actually be easier to rewrite it from scratch. To make it future-proof, consider using the opencart Events System.

Active Member

Posts

Joined
Wed Sep 30, 2020 7:58 pm

Post by enolia » Fri Apr 01, 2022 3:38 pm

Thanks for your answer.
At the end, we need to find a way to change a button permanently, like I said before. The first time to change this button, I modify the information inside the core file (.php and .twig). It is my expectation that my changes will survive an update.
Unfortunately, there is no full backup. There is no error log, the changes just disappeared.

Newbie

Posts

Joined
Mon Mar 21, 2022 4:44 pm

Post by mikeinterserv » Sat Apr 02, 2022 4:31 am

enolia wrote:
Fri Apr 01, 2022 3:38 pm
Thanks for your answer.
At the end, we need to find a way to change a button permanently, like I said before. The first time to change this button, I modify the information inside the core file (.php and .twig). It is my expectation that my changes will survive an update.
Unfortunately, there is no full backup. There is no error log, the changes just disappeared.
Well if you want an extension for quotes - I have one that may help
If price is 0.00 it will change add to cart button to GET QUOTE, it will REMOVE qty and tax and replace price also with get quote.
When you click the get quote button it will take you to the contact page with the product name and some text like please send me a quote for: and then product name. automatically filling the text area. Customer can send a request in 2 clicks. It works on PRODUCT PAGE with related products and also CATEGORY PAGES.
It can be expanded easily to all the others like best sellers, new products etc etc. If you want to try it let me know. As an 3xtension it will survive updates :-)
First image is a category product. Second the text from main product.
.

Attachments

Clipboard02.jpg

Clipboard02.jpg (21.56 KiB) Viewed 4129 times

Clipboard01.jpg

Clipboard01.jpg (13.71 KiB) Viewed 4131 times


Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by mikeinterserv » Sat Apr 02, 2022 8:30 am

You can try this. Its an OCMod so after installing remember to refresh modifications.
If you think its any good for what you need feel free to use it.
I will make an extension/module based on events of the same shortly.
Because it has a few lines there is potential for conflict with other mods if you use a lot of them.
If you have any modifications that affect the product / category pages there is the potential for issues. If you encounter any just let me know.
Can easily be tweaked for specific need / text.
.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by enolia » Mon Apr 04, 2022 9:42 pm

mikeinterserv wrote:
Sat Apr 02, 2022 4:31 am
Well if you want an extension for quotes - I have one that may help
If price is 0.00 it will change add to cart button to GET QUOTE, it will REMOVE qty and tax and replace price also with get quote.
When you click the get quote button it will take you to the contact page with the product name and some text like please send me a quote for: and then product name. automatically filling the text area. Customer can send a request in 2 clicks. It works on PRODUCT PAGE with related products and also CATEGORY PAGES.
It can be expanded easily to all the others like best sellers, new products etc etc. If you want to try it let me know. As an 3xtension it will survive updates :-)
First image is a category product. Second the text from main product.
.
I really want to try it if it's possible!

Newbie

Posts

Joined
Mon Mar 21, 2022 4:44 pm

Post by straightlight » Mon Apr 04, 2022 9:54 pm

enolia wrote:
Mon Apr 04, 2022 9:42 pm
mikeinterserv wrote:
Sat Apr 02, 2022 4:31 am
Well if you want an extension for quotes - I have one that may help
If price is 0.00 it will change add to cart button to GET QUOTE, it will REMOVE qty and tax and replace price also with get quote.
When you click the get quote button it will take you to the contact page with the product name and some text like please send me a quote for: and then product name. automatically filling the text area. Customer can send a request in 2 clicks. It works on PRODUCT PAGE with related products and also CATEGORY PAGES.
It can be expanded easily to all the others like best sellers, new products etc etc. If you want to try it let me know. As an 3xtension it will survive updates :-)
First image is a category product. Second the text from main product.
.
I really want to try it if it's possible!
Have you tried the OCMod above?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by enolia » Mon Apr 04, 2022 10:05 pm

straightlight wrote:
Mon Apr 04, 2022 9:54 pm
Have you tried the OCMod above?
Yes, but unfortunately it doesn't work at all, I don't see any changes in the website after refreshment.

Newbie

Posts

Joined
Mon Mar 21, 2022 4:44 pm

Post by straightlight » Mon Apr 04, 2022 10:24 pm

enolia wrote:
Mon Apr 04, 2022 10:05 pm
straightlight wrote:
Mon Apr 04, 2022 9:54 pm
Have you tried the OCMod above?
Yes, but unfortunately it doesn't work at all, I don't see any changes in the website after refreshment.
When looking at your OCMod Logs, what does it state about this OCMod installation?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by straightlight » Mon Apr 04, 2022 10:38 pm

So to add, I would suggest to use this extension: https://www.opencart.com/index.php?rout ... n_id=22014 since, in this scenario, you are asking forum supporters to provide a free extension while there are already extensions available on the Marketplace that delivers the need by Opencart Partners.

For the price being 0: https://www.opencart.com/index.php?rout ... n_id=22965 . This free extension is for earlier OC versions but can be easily converted. Please take the time to search the Marketplace.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by mikeinterserv » Mon Apr 04, 2022 11:06 pm

enolia wrote:
Mon Apr 04, 2022 9:42 pm
I really want to try it if it's possible!
In your MODIFICATIONS log file tab you will see this somewhere.
---------------------------------------------------------
MOD: MW OC Quotes
FILE: catalog/view/theme/default/template/product/product.twig
CODE: <button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><span class="hidden-xs hidden-sm hidden-md" id="cart-added">{{ button_cart }}</span> <i class="fa fa-shopping-cart"></i></button>
LINE: 494
CODE: {{ footer }}
LINE: 785
------------------------------------------------------------
and there will be more lines of text underneath.
Highlight and copy that section and post it here and we can see what is happening.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by enolia » Mon Apr 04, 2022 11:18 pm

mikeinterserv wrote:
Mon Apr 04, 2022 11:06 pm
Highlight and copy that section and post it here and we can see what is happening.
This is all the lines concerning the MW OC Quotes
MOD: MW OC Quotes

FILE: catalog/view/theme/default/template/product/product.twig
CODE: <button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><span class="hidden-xs hidden-sm hidden-md" id="cart-added">{{ button_cart }}</span> <i class="fa fa-shopping-cart"></i></button>
NOT FOUND - OPERATIONS ABORTED!

FILE: catalog/view/theme/default/template/product/category.twig
CODE: <button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><span class="hidden-xs hidden-sm hidden-md" id="cart-added">{{ button_cart }}</span> <i class="fa fa-shopping-cart"></i></button>
NOT FOUND - OPERATIONS ABORTED!

FILE: catalog/controller/product/product.php
CODE: $data['heading_title'] = $product_info['name'];
LINE: 244
CODE: if ($this->customer->isLogged() || !$this->config->get('config_customer_price'))
LINE: 297
CODE: if ((float)$product_info['special'])
NOT FOUND - OPERATIONS ABORTED!

FILE: catalog/controller/information/contact.php
CODE: $data['breadcrumbs'] = array();
LINE: 35

FILE: catalog/controller/product/category.php
CODE: if ($this->customer->isLogged() || !$this->config->get('config_customer_price'))
LINE: 174
CODE: if ((float)$result['special'])
NOT FOUND - OPERATIONS ABORTED!

FILE: catalog/view/theme/default/template/information/contact.twig
CODE: <textarea name="enquiry" rows="10" id="input-enquiry" class="form-control">{{ enquiry }}</textarea>
NOT FOUND - OPERATIONS ABORTED!

Newbie

Posts

Joined
Mon Mar 21, 2022 4:44 pm

Post by straightlight » Mon Apr 04, 2022 11:20 pm

enolia wrote:
Mon Apr 04, 2022 11:18 pm
mikeinterserv wrote:
Mon Apr 04, 2022 11:06 pm
Highlight and copy that section and post it here and we can see what is happening.
This is all the lines concerning the MW OC Quotes
MOD: MW OC Quotes

FILE: catalog/view/theme/default/template/product/product.twig
CODE: <button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><span class="hidden-xs hidden-sm hidden-md" id="cart-added">{{ button_cart }}</span> <i class="fa fa-shopping-cart"></i></button>
NOT FOUND - OPERATIONS ABORTED!

FILE: catalog/view/theme/default/template/product/category.twig
CODE: <button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><span class="hidden-xs hidden-sm hidden-md" id="cart-added">{{ button_cart }}</span> <i class="fa fa-shopping-cart"></i></button>
NOT FOUND - OPERATIONS ABORTED!

FILE: catalog/controller/product/product.php
CODE: $data['heading_title'] = $product_info['name'];
LINE: 244
CODE: if ($this->customer->isLogged() || !$this->config->get('config_customer_price'))
LINE: 297
CODE: if ((float)$product_info['special'])
NOT FOUND - OPERATIONS ABORTED!

FILE: catalog/controller/information/contact.php
CODE: $data['breadcrumbs'] = array();
LINE: 35

FILE: catalog/controller/product/category.php
CODE: if ($this->customer->isLogged() || !$this->config->get('config_customer_price'))
LINE: 174
CODE: if ((float)$result['special'])
NOT FOUND - OPERATIONS ABORTED!

FILE: catalog/view/theme/default/template/information/contact.twig
CODE: <textarea name="enquiry" rows="10" id="input-enquiry" class="form-control">{{ enquiry }}</textarea>
NOT FOUND - OPERATIONS ABORTED!

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by mikeinterserv » Tue Apr 05, 2022 12:54 am

enolia wrote:
Mon Apr 04, 2022 11:18 pm
This is all the lines concerning the MW OC Quotes
Ok that clears that up :-)
What theme do you have installed.
What extensions do you have installed.
Second don't worry about it - I will make an extension based on events that will cure this problem of OCMods compatability which is what I think is happening here.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by enolia » Tue Apr 05, 2022 8:30 pm

mikeinterserv wrote:
Tue Apr 05, 2022 12:54 am
Ok that clears that up :-)
What theme do you have installed.
What extensions do you have installed.
Apparently I have the basic theme. And I don't have any extension at this moment on Opencart.

Newbie

Posts

Joined
Mon Mar 21, 2022 4:44 pm

Post by straightlight » Tue Apr 05, 2022 8:31 pm

enolia wrote:
Tue Apr 05, 2022 8:30 pm
mikeinterserv wrote:
Tue Apr 05, 2022 12:54 am
Ok that clears that up :-)
What theme do you have installed.
What extensions do you have installed.
Apparently I have the basic theme. And I don't have any extension at this moment on Opencart.
Then, yes; Event triggers should of been used originally.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by mikeinterserv » Tue Apr 05, 2022 9:53 pm

straightlight wrote:
Tue Apr 05, 2022 8:31 pm
Then, yes; Event triggers should of been used originally.
As you well know events are not used in this XML OCMod This is an older mod.
Its been installed on all 3X versions without issue. So I don't know what the problem is with the OPs OC intall.
As I said I will make an installable version based off events.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by OSWorX » Tue Apr 05, 2022 10:26 pm

Just do add my "2 cents" ..

The "problem" is this here:

Code: Select all

<button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><span class="hidden-xs hidden-sm hidden-md" id="cart-added">{{ button_cart }}</span> <i class="fa fa-shopping-cart"></i></button><
because such a line does NOT exist in a default, standard template.
It should be instead:

Code: Select all

<button type="button" onclick="cart.add('{{ product.product_id }}', '{{ product.minimum }}');"><span class="hidden-xs hidden-sm hidden-md">{{ button_cart }}</span> <i class="fa fa-shopping-cart"></i></button>

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 72 guests