Add button to change to product card
We make the possibility of editing the goods directly from the storefront, we add the button to change.
Creation, development, manufacturing sites | WEB-STYDIA.COM

Kind time of the day dear visitor.

It happens that you are viewing some kind of product in your shop as an ordinary buyer, and notice an error in it, or you just need to change the price, or the description, but whatever it is, is not that ....

And the point is that when you want to edit the product, you need to go to the admin panel, and find this product first and only after you can click the edit button to edit the product itself.

And it would be nice to add the "change" button directly to the product card from the storefront, by clicking on which you immediately get to the page for changing this product.

Today I will show you a method of how to do this quickly and simply, with just a few lines of code.

An example of what we will get you can see here:

As a result, we will get so that the administrator viewing the goods can immediately click on the button to change and edit it, while the button will be shown only to the administrator, the user does not see this button ....

Okay let's get down to the task and make it possible to edit our product right from the opencart window!

We will make changes on a standard template.

And so we need to open the file: catalog/view/theme/default/template/product/product.tpl

And in it in the place you need, add the code:

Personally, I added in this example immediately opposite the model after:

So we put our button on the product card, it's already working, and if you change the line in the code:

On your text, you can already use it.

But we want to make the editing button beautiful and that it would work in different languages.

Add localization support, open the file: catalog/controller/product/product.php

And somewhere after:

Add:

Then open the language file: catalog/language/russian/product/product.php

And in it somewhere we insert:

I inserted after:

The same actions are done with other language files.

That's all now you have a button can be displayed in different languages.

Well, the last is a few lines of styles for our button that you need to put in the style file of your template:

Well, that's all, such a simple and very convenient solution that will make it possible not to waste time searching for the edited product and immediately edit it!

So try and test.

You may also like

No Comment

You can post first response comment.

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter a message.