opencart2.x , Issue in defining custom variable & showing in category page in opencart


Issue in defining custom variable & showing in category page in opencart

Question:

Tag: opencart2.x

I am facing 1 weird issue in opencart. My version is 2.0.2.0.

My approach to show any custom variable's value in header & footer is....I go to language file & add a variable there then in controller file with $data['...'] & then use that variable in view file.

But my issue here is I can not do this for category page. I wrote a variable in 1) language/english/product/category.php then in 2) catalog/controller/product/category.php & then in 3) template/product/category.tpl but that variable is not coming & instead giving error that.....that variable is not defined so what should I do to achieve that?

Thanks


Answer:

If you installed any extension that modified category, then check if there is a category.php file there, if so, modify that file instead.

\system\modification\catalog\controller\product\category.php

Related:


OpenCart 2.0 I can't add modules (ControllerModuleMinicart::redirect() error)


php,opencart,opencart2.x
I'm trying to add modules to the latest OpenCart version and so far no one worked. First I'm trying to add side cart, I found couple modules, but all of them are for earler versions and doesn't work with 2.0, also I tried to add facebook like box extension and...

How to make vertical navigation bar in Opencart v2.0.1.1?


opencart,opencart2.x
I am using Opencart V2.0.1.1. Please suggest how to change the default Opencart navigation bar(Horizontal) to the Vertical. With Sub-Categories popping in right side.

Fatal error: Call to undefined method in opencart


php,opencart,opencart2.x
When i am trying to save a module details, it shows the below error, i don't know what is the mistake over there, but the data's are stored but every time i try to save i get this error. ERROR Fatal error: Call to undefined method ControllerPaymentIcicipg::redirect() in C:\xampp\htdocs\usa\admin\controller\payment\icicipg.php on...

page specific product template opencart 2.0.1.1


css,templates,switch-statement,opencart2.x
I would like to create page specific template files for opencart 2.0.1.1 using the "location" field. I would like to know can this work with seo url's I have found this at the bottom of the header.php for opencart 2.0.1.1 // For page specific css if (isset($this->request->get['route'])) { if (isset($this->request->get['product_id']))...

Opencart 2 - Custom shipping Methods


php,opencart,opencart2.x
I was wondering whrere the shipping methods are set up in Opencart 2 - not in the Admin-Panel, but on the server and database. I would like to set up my own (stub-) shipping method without the use of Extensions - maybe by cloning and customizing an existing one, but...

Opencart how to show free shipping if order is above X amount otherwise X delivery charges?


shipping,opencart2.x
I would like to if order is above x amount then free shipping otherwise need to charge x amount. In Free Shipping i already set X amount. In Flat Rate i set X amount. But in frontend if order is above x amount then it display both Free Shipping &...

Opencart Payment gateway error after opencart 2.0 upgrade


php,payment-gateway,opencart2.x
We have a payment gateway called atom for our opencart store. Recently we have upgraded Opencart from 1.5.6.4 to 2.0.1.0 version. Due to this payment method stopped working. I have gone through this post to understand the changes in opencart 2.0 Below is my updated code //catalog/controller/payment/atompay.php <?php class ControllerPaymentAtompay...

How does free checkout work in Opencart 2?


opencart,opencart2.x
I am trying to make a development site where I can add products to my cart and delivery options - and then checkout. I want to be able to do dummy orders without using real cards or payment gateways I have enabled free checkout but it does not appear on...

Opencart 2 : Add currently logged admin id to oc_product table on product insert


php,opencart,opencart2.x
I would like to monitor which dashboard user ("admin") added new product to the database. The solution i was thinking about is simply adding another insert under admin > model > catalog > product.tpl under function addProduct(), which adds the user id to the custom column added before under oc_product....

Opencart 2.0.2.0 mail error on mail.php line 168


php,opencart2.x
I have recently updated opencart 1.5.6.4 to opencart 2.0.2.0. The day I updated, Mail stopped working. Now I am unable to register any user or retrieve password. I was happily using the mail before, now with the same settings I can't send any email. Following are the mail settings I...

Jquery selector not pulling text out


php,jquery,opencart2.x
Im working inside of opencart's framework. The base install has the exact same code but mine doesn't seem to be working. I'm not seeing any errors. Im unsure how to make my selectors in jquery work. When the below code is ran it doesn't find the text in the span....

Modification requires a unique ID code! Opencart OCMOD


php,xml,opencart2.x
In Opencart 2.0.1.1, I tried to upload an OCmod configuration file with right name format .ocmod.xml but I get the error Modification requires a unique ID code!

Proper way to work using the real image of a product on OpenCart 2


opencart,opencart2.x
I'm currently looking for the proper way to work on a theme using the real image of a product and not its thumbnail (identified as $thumb in the default theme). I have found a abrupt trick by adding a line in the controller file: $this->data['cover'] = $product_info['image']; But does anybody...

opencart 2.x: How to identify which submit button was pressed?


php,opencart2.x
On my front page in opencart I've got a panel with login (which says that user is logged or if not then asks for login and password) and it has IF condition inside the controller: if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { The contact page also has the same IF...

Admin is showing different price to Front End


opencart,opencart2.x
I have set up an OpenCart store for my Australian company. In System>>Localisation>>Currencies I created a new Currency for Australian Dollars with the code AUD. Then in System>>Settings>>Store Name>>Local I set the Country to Australia and the Currency to AU Dollar: But when I add a new product and set...

How to call one controller on every page


opencart2.x
If I want to load controller or module on every page , Should I load controller every time? My question is what is the best practice to load controller on every page?

Add Slider Extension in Opencart?


opencart,opencart2.x
I am Creating a Opencart Page with 1500 products. In homepage I want Slider Extension For Products With Time interval. . How can i Add the extension . . Help me Out Here. . For Extension Code.....

Send Attachment in PHP with OpenCart 2.1.1.1


php,opencart2.x
Does anyone with knowledge of OpenCart 2.0.1.1 know how I could implement the following addAttachment function found in system/libary/mail.php: public function addAttachment($filename) { $this->attachments[] = $filename; } into catalog/controller/information/contact.php - so that the default contact form can also include an attachment upload feature? I tried this but no dice. if...

In OpenCart, How can I customize the info visible on the product page


php,admin,category,opencart2.x
Okay, first I want to say that I am not a geek programmer. I am intermediate to programming. I was recently learning Php through teamtreehouse, which I have not finished yet. But instead I started making an online store from OpenCart. I watched some youtube videos and added some products,...

Insert based on conditions


mysql,opencart,opencart2.x
I am trying to insert some data in mysql table. I have an option in opencart with option_id = 6, I want to insert into all products containing option_id=6 a new option with option_id=9. insert into oc_product_option (`option_id`) select 9 where (SELECT `option_id` FROM oc_product_option WHERE `option_id` == 6); is...

Issue in defining custom variable & showing in category page in opencart


opencart2.x
I am facing 1 weird issue in opencart. My version is 2.0.2.0. My approach to show any custom variable's value in header & footer is....I go to language file & add a variable there then in controller file with $data['...'] & then use that variable in view file. But my...

How to get current category id - OpenCart 2.0


php,opencart2.x
I have a code for product tpl witch I need a condition if a category id=12 echo.. THe code below works on opencart 1.5.6.4 but on 2.0 doesn't generate anything. <?php if(isset($this->request->get['path'])) { $path = $this->request->get['path']; $cats = explode('_', $path); $cat_id = $cats[count($cats) - 1]; } ?> <?php if (isset($cat_id)...

Change default country in OpenCart


opencart2.x
I'm using latest version of OpenCart 2.0.2.0 whenever I go to register page site/index.php?route=account/register it shows United states as default. I know how to change this default country to another default country. Here what I need is, if a user go to register page it will show please select instead...

$this->config->get('something') in opencart


php,oop,web,opencart,opencart2.x
I am newbie in opencart as well as in php. I am discovering opencart templates, I found $this->config->get this line, I am a little bit confused about this. I don't understand clearly. I this request we are using this object (current) access config object and call get method of config...

Adding price and total column in shipping invoice in opencart


php,opencart2.x
Opencart by default doesn't show price and total in the print shipping at the admin side. So I added two more columns to the table in shipping invoice in order_shipping.tpl in admin/view/template/sale/order_shipping.tpl but I got the error as Notice: Undefined variable: column_price in /home/blossewp/public_html/admin/view/template/sale/order_shipping.tpl on line 69 Notice: Undefined index:...

Show unit of weight in product page for Opencart 2


php,opencart,opencart2.x
Hi! How to display the unit of weight (kg., gr., oz., ml.,) in product page in Opencart 2.0.2.0 Now only displays a number without units. I'm Using the default template in file template\product\product.tpl it looks like this: ...<li><?php echo $text_model; ?> <?php echo $model; ?></li> <?php if ($weight) { ?>...

How to install VQmod extension for opencart 2.0.x.x without using FTP


opencart2.x,vqmod
I have installed vqmod extension for opencart 2.0.1.0 from following link http://www.opencart.com/index.php?route=extension/extension/info&extension_id=19501 I have followed installation steps till replaced files. Now, how I should upload Opencart modifications on localhost. On admin panel made following setting System->Setting->Store Edit->FTP FTP Host : localhost FTP Port : 22 FTP Username : XXXXXX FTP...

ocmod, replace in controller Opencart 2.0.1.1


opencart2.x
I did asked this question on OpenCart's forum but didn't get any answers so i try to ask it here instead and hopefully get a good answer :). Ok let's go to my problem. I am trying to remove the required field for product name on product page in admin....

How to insert module in header tpl file in opencart 2.0?


opencart2.x
How to insert a module in header.tpl file in opencart 2.0 ? I have a module. Does not have the layout position option for that module. So i need to place that manually in header.tpl file. I am already tried this but not working for opencart 2.0. Please any one...