Archive for the ‘Php’ Category

Sometimes it’ll be better to split the template file into separate files for various things that need to be shown in that page. The most standard way is to use opencart ‘module’ concept and assign it to necessary pages via the admin panel. However, there can be situation where we cannot assign and use opencart modules. In that case, add the code in a separate function in controller and create a new template file for it.

Suppose we want to show similar products in product page without using opencart modules. In that case, create a new file named ‘similar_products.tpl’ and use it in the following way: (more…)

Opencart: Vqmod tutorial

Posted: November 25, 2013 by Sankar Vijayakumar in OpenCart, Php
Tags: , , , , , ,

Opencart

Vqmod stands for ‘Virtual Quick Mod‘, also known as ‘Virtual File modification System‘. It’s used to virtually alter any php or tpl file in OpenCart except the main index.php files. The changes are mentioned in xml files using search/add/replace tags and these files are parsed on page load. The original core files with the xml files’ code injected to it are then executed. The files with injected code can be viewed in vqmod/vqcache folder. Thus the core files are never touched and the opencart version upgrade can be done anytime.

Advantages of Vqmod:

  1. No need to edit the core files.
  2. Fallback to original sourcefiles in case of errors.
  3. Opencart version upgrade can be done easily by replacing core files.
  4. Website Performance never gets affected due to vqmod xml files.
How to install vqmod?

(more…)

Opencart: Add bcc and cc in emails

Posted: August 6, 2013 by Sankar Vijayakumar in OpenCart, Php
Tags: , , , , ,
How to add cc mails in opencart?

Here’s it, just 1 file needs to be modified:

system\library\mail.php

  1. After “protected $to;” add:
    protected $cc;
  2. Below “public function setTo($to) {” function add: (more…)
How to add separate google analytics code for each store?

Here’s it, just 3 files need to be modified:

  1. admin\controller\setting\store.php
    After “$this->data[‘entry_secure’] = $this->language->get(‘entry_secure’);” add:

    $this->data['entry_google_analytics'] = $this->language->get('entry_google_analytics');

    Before “$this->template = ‘setting/store_form.tpl’;” add: (more…)

Typo3 Php

        Let’s check a few php codes related to typo3:-

  1. Php code to fetch extension configuration values from extension manager configuration tab fields

    $variable_name = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ext_name']); //returns an array.

    Ext_name should be replaced with the extension key.

    Sample code for getting the language keys given in lfeditor “viewlanguages” field: (more…)

get values of fields inside the Section of elements(sc)/Container for elements(co) in templavoila flexible content element

First of all for those who are trying to find a method using typoscript please keep on trying until you’re sure that it’s not possible and for those who got a solution for this question using typoscript please send me or share it somewhere. Before solving this using an userfunction, I had a strong feeling that it’s possible via typoscript (like appending the values to a typoscript variable inside the section and use it outside the section of elements.) and I spend a whole day in search of a typoscript solution but didn’t succeed.
Just by referring the field name it’s possible to get the values of fields in the same level of an FCE. But the same way we can’t take the values of fields inside a “Section of elements” for the fields outside it. For this we can make use of an userfunction as shown below:

  1. Include the php file in the Setup section of TS template:
    includeLibs.fce_values= fileadmin/templates/user_getFlexformFieldValue.php
  2. Code in user_getFlexformFieldValue.php file (the same code that I used in my website – used for fetching the file names added via image field): (more…)