Page 1 of 2
edit erased
Posted: Mon Mar 28, 2022 9:02 pm
by enolia
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
Re: edit erased
Posted: Mon Mar 28, 2022 9:24 pm
by straightlight
OC version. More info.
Re: edit erased
Posted: Mon Mar 28, 2022 10:06 pm
by enolia
We are in 3.0 version
Re: edit erased
Posted: Mon Mar 28, 2022 10:56 pm
by Gergely
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:
- 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
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.
Re: edit erased
Posted: Fri Apr 01, 2022 3:38 pm
by enolia
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.
Re: edit erased
Posted: Sat Apr 02, 2022 4:31 am
by mikeinterserv
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.
.
Re: edit erased
Posted: Sat Apr 02, 2022 8:30 am
by mikeinterserv
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.
.
Re: edit erased
Posted: Mon Apr 04, 2022 9:42 pm
by enolia
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!
Re: edit erased
Posted: Mon Apr 04, 2022 9:54 pm
by straightlight
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?
Re: edit erased
Posted: Mon Apr 04, 2022 10:05 pm
by enolia
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.
Re: edit erased
Posted: Mon Apr 04, 2022 10:24 pm
by straightlight
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?
Re: edit erased
Posted: Mon Apr 04, 2022 10:38 pm
by straightlight
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.
Re: edit erased
Posted: Mon Apr 04, 2022 11:06 pm
by mikeinterserv
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.
Re: edit erased
Posted: Mon Apr 04, 2022 11:18 pm
by enolia
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!
Re: edit erased
Posted: Mon Apr 04, 2022 11:20 pm
by straightlight
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!
Re: edit erased
Posted: Tue Apr 05, 2022 12:54 am
by mikeinterserv
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.
Re: edit erased
Posted: Tue Apr 05, 2022 8:30 pm
by enolia
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.
Re: edit erased
Posted: Tue Apr 05, 2022 8:31 pm
by straightlight
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.
Re: edit erased
Posted: Tue Apr 05, 2022 9:53 pm
by mikeinterserv
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.
Re: edit erased
Posted: Tue Apr 05, 2022 10:26 pm
by OSWorX
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>