opencart

Accessing class properties and methods from template

一笑奈何 提交于 2019-12-06 15:26:37
Prior to Opencart 2.0 class properties could be accessed directly from the template. For example, $this->config->get('config_language') or $this->request->get['route'] were both accessible from an admin template file. With the new method $this->load->view() , neither of these work. Is there a simple way to pass on class methods and properties which are available in the current controller to the tpl without explicitly adding them to the $data array? Nikhil Chaudhary In Opencart version 2, if you want these variables then you can easily access them. There is slight change is code, now you can

In frontend how to get which language is active among installed different languages in Open cart?

99封情书 提交于 2019-12-06 15:07:16
问题 I have installed and themed Opencart 1.5.4x with multiple languages (English, Duch, German) on live server. Opencart application works properly with these languages. When I click on the language link and browse whole site, the content of the site is translated in this language, but how to find out, programatically, which language is active? I need to show the user which language is currently active. 回答1: I guess You should call $this->config->get('config_language_id'); within a controller or

How to get currency to show on product page in opencart?

别来无恙 提交于 2019-12-06 12:07:39
I want to display the currency list on the product description page. How can I do that? I copied the code from header.tpl () and pasted it in the product.tpl but I get an error: Notice: Undefined variable: currency in C:\xampp\htdocs\mysite.com\catalog\view\theme\mytheme\template\product\product.tpl on line 60. I tried adding the following code in product.tpl. <?php include(DIR_APPLICATION.'\view\theme\mytheme\template\module\currency.tpl'); but that did not work either. Please help as I want to get this working. controller/common/header.php function index() add in to: $this->data[

Display block HTML only on main page?

旧时模样 提交于 2019-12-06 08:21:33
I tried to modify home controller adding new variable: $data["header_home"] = true; Then I try to check this in header.twig tetmplate like as: {% if header_home %} <div>Home</div> {% else %} <div>Not Home</div> {% endif %} When I open home page by index.php or just url address it does not work, I mean I dont see <div>Home</div> . How to fix it, what do wrong? This is home controller: <?php class ControllerCommonHome extends Controller { public function index() { $this->document->setTitle($this->config->get('config_meta_title')); $this->document->setDescription($this->config->get('config_meta

how to add Information Links in Navigation Menu in opencart?

孤街醉人 提交于 2019-12-06 08:13:01
问题 I got this error when trying to add the information Link in open cart top navigation menu Notice: Undefined variable: informations in C:\Inetpub\vhosts\fima.net.in\httpdocs\catalog\view\theme\fima\template\common\header.tpl on line 229 Warning: Invalid argument supplied for foreach() in C:\Inetpub\vhosts\fima.net.in\httpdocs\catalog\view\theme\fima\template\common\header.tpl on line 229 Code: <ul> <?php foreach ($informations as $information) { ?> <li> <a href="<?php echo $information['href']

Product page as homepage in Opencart

百般思念 提交于 2019-12-06 07:47:25
I have only one product on my opencart and I want this product just to be in the homepage so that the customer will no longer go to any page just to buy the product. How can I make this product as default homepage? or How can I make the url default to the url of this product? I'm using opencart. I've tried to override the layout of the product but it didn't work. "Opencart Admin > Product > Porduct Page > Layout Tab > Override (Home)". Both of these require you to edit your /catalog/controller/common/home.php and place the code after the public function index() { line, changing 123 to your

How do I post some variables to a file using opencart?

筅森魡賤 提交于 2019-12-06 06:57:00
I'm having some trouble posting variables within opencart. What I'm trying to do is to grab two variables from text fields on the checkout/login page, called name and address. I want the values entered into these two fields to be stored when the continue button is clicked, and then sent to the checkout/guest page, where i want to echo out these variables. Here is what i have done: Here is my checkout.tpl file, where I am attempting to send the name and address variables to the checkout/guest page, specifically to the receive method: $('#button-account').live('click', function() { var name = $(

Permission denied on opencart

本小妞迷上赌 提交于 2019-12-06 03:52:42
I was trying to create a payment module for opencart. When i tried to save the details in settings page, it's giving me the error "Permission Denied!" even though I was logged in as a administrator. Can anyone help me in this? You need to set yourself with permissions. Go to SYSTEM > USERS > USER GROUPS in the admin panel, click EDIT next to your user group, then make sure the boxes are checked next to payment/your-payment-name-here (or just click Select All Under both boxes) 来源: https://stackoverflow.com/questions/11187930/permission-denied-on-opencart

How does the Opencart system/modifications folder function?

穿精又带淫゛_ 提交于 2019-12-06 00:47:57
I am quite new to OC 2.X and I noticed as I was making changes to the site they werent appearing. When I went to change within the system/modifications folder the changes appeared. I assumed this folder was something new and nothing to do with vqmod. I thought it was a foler that would basically take priority over the core file. Unfortunately when I installed a plugin it also rebuilt that folder so Ive lost all my changes (Im assuming thats what happened). Im wondering how does this work overall? Must I make a new extension for every change I would like to make? I cannot find a clear and

How to solve a Linux permission issue for opencart

自闭症网瘾萝莉.ら 提交于 2019-12-06 00:07:50
问题 I had used subversion to revert my PHP Opencart project, but I got a permission issue (sample shown below: Warning: imagejpeg(): Unable to open '/var/www/html/opencart/image/cache/data/pavblog/img-blog-620x300w.jpg' for writing: Permission denied in /var/www/html/opencart/system/library/image.php on line 45 Warning: imagejpeg(): Unable to open '/var/www/html/opencart/image/cache/data/pavblog/img-blog-250x250w.jpg' for writing: Permission denied in /var/www/html/opencart/system/library/image