how to put opencart 2.0 customer name on header? - opencart

Can Any One Please Tell Me
how to put opencart 2.0 customer first name and last name on header?
I Am Already Use this Code For Opencart 1.5.6 Working Fine But In 2.0 Getting Error
$this->customer->getFirstName(); ?> $this->customer->getLastName(); ?>
But ThisCode Is Not Working For 2.0 Version
I Am Getting This Error : Undefined property: Loader::$customer in header.tpl
Please Help Me Any One
Thanks

To fix this error you need to call them in the controller instead of in the template.
In catalog/controller/common/header.php add the following code inside the index() function:
$data['customer_firstname'] = $this->customer->getFirstName();
$data['customer_lastname'] = $this->customer->getLastName();
In catalog/view/theme/your-theme/template/common/header.tpl you can echo the first and last name:
echo $customer_firstname;
echo $customer_lastname;
Note that it is better not to edit Opencart core files. Instead you can use VQMod to implement the changes in the header controller.

Related

i18n HTML escaping not working

According to Ruby on Rails Guides (http://guides.rubyonrails.org/i18n.html#using-safe-html-translations) all I need to do to render my translations without calling html_safe on them is to have the key name end with _html. This is what I tried:
en:
breadcrumbs:
root_html: "<i class='material-icons'>home</i>"
Calling it like this:
I18n.t('breadcrumbs.root_html')
causes the output to be this very string defined inside my translations, but not the rendered HTML.
What am I doing wrong?
Using Ruby on Rails 4.2.1.
Thanks in advance!
Scrolling down a little further in the guide I found the problem:
Automatic conversion to HTML safe translate text is only available from the translate view helper method.
Since I tried to prepare the link inside my controller and pass it through a gem to the view, this didn't work.
To make this work you'll have to call html_safe on the string, like so:
I18n.t('breadcrumbs.root_html').html_safe
If you find another solution, hit me up!

Vtiger 6 - customize login page

Where is the login page for VTIGER 6?
I tried /Smarty/templates.
However, the login.tpl there is the old Vtiger 5.4.
I want to customize the login page.
Thanks.
To customize login page, just go to folder: vtigercrm\layouts\vlayout\modules\Users
Duplicate file: Login.Default.tpl rename to Login.Custom.tpl
You can modify it safely there
In case, you need some new images or modify them, you can go to folder: vtigercrm\layouts\vlayout\skins\images
Full customization for vTiger 6 can be done via the following files:
layouts\vlayout\modules\Users\login.tpl
layouts\vlayout\modules\Vtiger\header.tpl
layouts\vlayout\skins\softed\style.css
Its in layouts/vlayout/modules/Users/login.tpl
I doubt you are using Vtiger EA version. Use the stable version always
in Vtiger version 6 the folder structure is changed a bit.
In new version they have moved it under layouts folder.
To modify you can edit the file layouts/vlayout/modules/Users/Login.tpl
Fore more details on new file/folder structure please check https://wiki.vtiger.com/index.php/Vtiger_6_Developer_Guide#Folder_Structure
Thank You
In case of vTigerCRM 6.0 use the following file to change the login screen
layouts/vlayout/modules/Users/login.tpl
And for vTigerCRM 6.2 onwards change the following file
layouts/vlayout/modules/Users/Login.Custom.tpl
Here login.tpl checks whether the developer has the Login.Custom.tpl or not (Please check the attached screenshot). Else it loads the Login.Default.tpl

How to get osCommerce 2.2 running on PHP 5.4?

I recently upgraded PHP to 5.4 and after adding some tweaks now the old osCommerce installation of a customer with lots of customisations is running again, but there is still a problem:
if you put an item in your cart the cart stays empty
How can I fix this?
Is there a certain php value I can set in php.ini so the session is working properly?
What I have tweaked so far:
Problem: all prices are 0 and there is no currency
Solution: adding !isset($currency) || in the paragraph `//
(see $currency not set in application_top under PHP 5.4 )
Problem: register_globals is REMOVED as of PHP 5.4.0
Solution: I simulated register_globals with this: https://serverfault.com/a/547285/128892
and I added this to includes/application_top.php:
// Bugfix PHP 5.4:
$HTTP_USER_AGENT=$_SERVER["HTTP_USER_AGENT"];
$HTTP_ACCEPT_LANGUAGE=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
$HTTP_HOST=$_SERVER["HTTP_HOST"];
$SERVER_NAME=$_SERVER["SERVER_NAME"];
$PHP_SELF=$_SERVER['PHP_SELF'];
$HTTP_GET_VARS=$_GET;
$HTTP_POST_VARS=$_POST;
register_globals();
comment out this line:
#ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
also I had to correct some removed functions in includes/functions/sessions.php: session_unregister() and session_is_registered()
Problem remaining:
Items filled into the cart don't get added to the cart. seems like the session isn't known in the add_cart page.
I've had the same problem. Found by comparing my 2.2ms2 code with rc2a version.
In application_top change
$cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+$quantity, $_POST['id']);
to
$cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+$_POST['quantity'], $_POST['id']);
I cound not fix this last problem, so after trying diffenent attempts I decided to take the effort and convert the shop with all its customisations into oscommerce 2.3 which still runs on PHP 5.4 (up to PHP 5.6).
Note that later, to get oscommerce running on php7 you'll need another fix for mysql functions to fix problems like Undefined function mysql_connect()

How do I access the current order id in opencart?

How do I access the current order id in opencart and put it in a variable? I am working in a new file, which did not come with the standard opencart install.
The closest I have been able to get is the following code, which doesn't work:
<?php
session_start();
$order_id = $this->session->data['order_id'];
?>
Thanks in advance.
The order ID isn't set until the customer gets to the final page of the checkout process, so you won't be able to get it before that. For your code above, you can't use $this->session->data['order_id'] unless you are in an opencart class, therefore you would need to use $_SESSION['order_id']

Using modules in Joomla K2 Sub-templates

I have a quick question connected with my little knowledge of Joomla\K2. I'm using subtemplates to create different layouts for different pages. When I declare module position on sub template:
<jdoc:include type="modules" name="position-7" />
Nothing happens. I've tried the same code for main template file and it worked, but seems like it's not parsed for sub-templates. Am I right? How can I include modules into sub-templates then?
thanks in advance,
Michael
jdoc tag only works in joomla core template. If you want to load modules of specific position in your k2 subtemplate write the following code at your desired location in that subtemplate.
$module = JModuleHelper::getModules('xxxx');
// xxxx is any virtual position, no need to create it anywhere.
echo JModuleHelper::renderModule($module[0]);
replace xxxx with your desired position name.