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
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
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.enolia wrote: ↑Mon Mar 28, 2022 9:02 pmHello,
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
If you would like to receive more specific help, it would be necessary to include more information:
- What exactly you are trying to achieve - you covered this: change Add to Cart button text for zero priced items
- What you have already tried - the methods you have used to carry out the edits
- What you expected to happen - this is implied, I guess: that your edits would survive an update(?)
- What happened (A precise description + screenshots + error logs if possible) - How did you update your site? why? did you do a backup? etc...
- Any additional info you already know about the problem
- Any troubleshooting attempts you have already tried
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.
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 helpenolia wrote: ↑Fri Apr 01, 2022 3:38 pmThanks 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.
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 (21.56 KiB) Viewed 4129 times
Clipboard01.jpg (13.71 KiB) Viewed 4131 times
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.
.
I really want to try it if it's possible!mikeinterserv wrote: ↑Sat Apr 02, 2022 4:31 amWell 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.
.
Have you tried the OCMod above?enolia wrote: ↑Mon Apr 04, 2022 9:42 pmI really want to try it if it's possible!mikeinterserv wrote: ↑Sat Apr 02, 2022 4:31 amWell 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.
.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
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
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
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.
This is all the lines concerning the MW OC Quotesmikeinterserv wrote: ↑Mon Apr 04, 2022 11:06 pmHighlight and copy that section and post it here and we can see what is happening.
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!
enolia wrote: ↑Mon Apr 04, 2022 11:18 pmThis is all the lines concerning the MW OC Quotesmikeinterserv wrote: ↑Mon Apr 04, 2022 11:06 pmHighlight and copy that section and post it here and we can see what is happening.
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
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.
Apparently I have the basic theme. And I don't have any extension at this moment on Opencart.mikeinterserv wrote: ↑Tue Apr 05, 2022 12:54 amOk that clears that up :-)
What theme do you have installed.
What extensions do you have installed.
Then, yes; Event triggers should of been used originally.enolia wrote: ↑Tue Apr 05, 2022 8:30 pmApparently I have the basic theme. And I don't have any extension at this moment on Opencart.mikeinterserv wrote: ↑Tue Apr 05, 2022 12:54 amOk that clears that up :-)
What theme do you have installed.
What extensions do you have installed.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
As you well know events are not used in this XML OCMod This is an older mod.straightlight wrote: ↑Tue Apr 05, 2022 8:31 pmThen, yes; Event triggers should of been used originally.
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.
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><
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.
Users browsing this forum: No registered users and 72 guests