Opencart VqMod Error - opencart

i have opencart 1.5.5.1 web site with VqMod(latest)
Vqmod running fine but i had a problem with one xml file.
xlm file has following lines
<file name="admin/view/template/common/header.tpl">
<operation>
<search position="replace" offset="8"><![CDATA[
<ul class="right" style="display: none;">
]]></search>
<add><![CDATA[
<ul class="right" style="display: none;">
<li id="store"><a onClick="window.open('<?php echo $store; ?>');" class="top">
but result was shown below.
File Name : admin/view/template/common/header.tpl(5)
VQModObject::applyMod - SEARCH NOT FOUND (ABORTING MOD): <ul class="right" style="display: none;">
there is a line <ul class="right" style="display: none;">in header.tpl but xml code is not working

Add this code for your replace you want hear:
<file name="admin/view/template/common/header.tpl">
<operation>
<search position="replace"><![CDATA[
<li id="store"><?php echo $text_front; ?>
]]></search>
<add><![CDATA[
<li id="store"><a onClick="window.open('<?php echo $store; ?>');" class="top"><?php echo $text_front; ?></a>
]]>
</add>
</operation>
</file>

This value " <ul class="right" style="display: none;">" is not exactly on this file
admin/view/template/common/header.tpl
Perhaps any other extension changes this file.
Also, you can try to quit this part - offset="8" , here:
<search position="replace" offset="8">
replace for:
<search position="replace">
I tried this, and it is good.

Related

How to get user information to .tpl file in opencart using vqmod?

I am new in opencart and I am trying to make some changes using vqmod.I have built a xml file which will add some text on product_list.tpl depending on user's id.The problem is that I cannot get id.I tried a lot but still no success.If anyone knows how can I achieve this please post.I get this notice on browser -> Notice: Undefined property: Loader
Here is my xml file:
<modification>
<id>GeoDim - add message products depending on user login</id>
<version>1.0</version>
<vqmver>2.4.1</vqmver>
<author>GeoDim</author>
<file path="admin/view/template/catalog/product_list.tpl">
<operation>
<search position="after"><![CDATA[div class="pull-right"]]></search>
<add><![CDATA[
<?php
// GeoDim - add message products depending on user login
$this->load->model('user/user');
$user_group_id = $this->model_user_user->getUsersGroupId($this->user->getId());
if ($user_group_id == 1) {
echo '<p style="background-color: yellow;font-size: 21px;float: left;margin-right: 5px"><i class="fa fa-exclamation-triangle"></i>Είστε στο TEST</p>';
}else {
echo '<p style="background-color: orange;font-size: 21px;float:left;margin-right:5px"><i class="fa fa-exclamation-triangle"></i>Είστε στο LIVE</p>';
}
// END GeoDim - add message products depending on user login
?>
]]></add>
</operation>
</file>
</modification>
Which version of Opencart?
Since there's no getUsersGroupId function in model/user/user.php on opencart 2.x I used getUser here, I've tested this on opencart 2.1.0.1.
You must first get user_group_id in controller file and then send it to view file via $data, so edit this file:
admin/controller/catalog/product.php
Find getList function and add this inside it:
$this->load->model('user/user');
$user_group_id = $this->model_user_user->getUser($this->user->getId());
if ($user_group_id['user_group_id'] == 1) {
$data['paragraph'] = '<p style="background-color: yellow;font-size: 21px;float: left;margin-right: 5px"><i class="fa fa-exclamation-triangle"></i>Είστε στο TEST</p>';
}else {
$data['paragraph'] = '<p style="background-color: orange;font-size: 21px;float:left;margin-right:5px"><i class="fa fa-exclamation-triangle"></i>Είστε στο LIVE</p>';
}
and then in admin/view/template/catalog/product_list.tpl use it:
<?php echo $paragraph; ?>
Here is full code:
<modification>
<id>GeoDim - add message products depending on user login</id>
<version>1.0</version>
<vqmver>2.4.1</vqmver>
<author>GeoDim</author>
<file path="admin/controller/catalog/product.php">
<operation>
<search position="after"><![CDATA[$results = $this->model_catalog_product->getProducts($filter_data);]]></search>
<add><![CDATA[
// GeoDim - add message products depending on user login
$this->load->model('user/user');
$user_group_id = $this->model_user_user->getUser($this->user->getId());
if ($user_group_id['user_group_id'] == 1) {
$data['paragraph'] = '<p style="background-color: yellow;font-size: 21px;float: left;margin-right: 5px"><i class="fa fa-exclamation-triangle"></i>Είστε στο TEST</p>';
}else {
$data['paragraph'] = '<p style="background-color: orange;font-size: 21px;float:left;margin-right:5px"><i class="fa fa-exclamation-triangle"></i>Είστε στο LIVE</p>';
}
// END GeoDim - add message products depending on user login
]]></add>
</operation>
</file>
<file path="admin/view/template/catalog/product_list.tpl">
<operation>
<search position="after"><![CDATA[div class="pull-right"]]></search>
<add><![CDATA[
<?php echo $paragraph; ?>
]]></add>
</operation>
</file>
</modification>

joomla condition position module for content

i create new template for j2.5,
i need to add many module only show on home,
now i need to show many module all page without home,
pleas see my code below :
<div class="row" style="margin-top:20px;">
<div class="col-xs-12 co-md-12">
<?php if($this->countModules('adsright')) : ?>
<div class="col-xs-12 col-md-2">
<jdoc:include type="modules" name="adsright" style="custom" />
</div>
<?php endif; ?>
<div class="col-xs-12 col-md-10">
<div class="content">
<jdoc:include type="message" />
<jdoc:include type="component" /> </div></div>
</div>
</div>
when add module to adsright position and unchecked home page,was not show on my content,
how can i solve that ?
please tell me full way for create position conditional.
thanks.
please give some clear description of your problem.
And if you want certain positions and div structure on home page and not require same on inner pages then you can set condition based on this code. I hope this will help.
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'Home page';
}

How to get related products in product tabs in opencart

I created a extra tab and custom design for related products in products page. I want to get product name,price and to add to cart,image in a loop. In related product tab check this url I am working on that http://efurnish.co.uk/index.php?route=product/product&path=86&product_id=58
<div class="product-related box">
<div class="box-heading"><span><?php echo $tab_related; ?> (<?php echo count($products); ?>)</span></div>
<div class="box-content products-block">
<?php foreach ($pr
oducts as $i => $product) { $i=$i+1; ?>
<?php if( $i%$cols == 1 && $cols > 1 ) { ?>
<div class="row product-related row-product">
<?php } ?>
<div class="col-lg-<?php echo $span;?>">
<div class="product-block">
<?php if ($product['thumb']) { ?>
<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>"
title="<?php echo $product['name']; ?>"
alt="<?php echo $product['name']; ?>"/></a>
</div>
<?php } ?>
<div class="name"><?php echo $product['name']; ?></div>
<div class="group-item">
<?php if ($product['rating']) { ?>
<div class="rating"><img
src="catalog/view/theme/<?php echo $this->config->get('config_template');?>/image/stars-<?php echo $product['rating']; ?>.png"
alt="<?php echo $product['reviews']; ?>"/></div>
<?php } ?>
<div class="price-cart">
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span
class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
<div class="cart">
<input type="button" value="<?php echo $button_cart; ?>"
onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"/>
</div>
</div>
</div>
<span class="wishlist"><a class="icon-heart" onclick="addToWishList('<?php echo $product_id; ?>');" data-placement="top" data-toggle="tooltip" data-original-title="<?php echo $button_wishlist; ?>"><span><?php echo $button_wishlist; ?></a></span></span>
<span class="compare"><a class="icon-retweet" onclick="addToCompare('<?php echo $product_id; ?>');" data-placement="top" data-toggle="tooltip" data-original-title="<?php echo $button_compare; ?>"><span><?php echo $button_compare; ?></a></span></span>
</div>
</div>
<?php if( $cols > 1 && ($i%$cols == 0 || $i==count($products)) ) { ?>
</div>
<?php } ?>
I am using this design http://bootsnipp.com/snippets/featured/store-product-layout
There is an option for related products in the product form in the admin panel. You can add related product there to show in the product tab.
To Add Related Products to a product:
In OpenCart admin panel navigate to Catalog -> Products
Search for the product you would like to add related products. Click
Edit link to edit it.
Choose Link tab and scroll down until you see the "Related Products" field.
Start typing a product name in that field and OpenCart will drop
down a list of products that start with whatever letters you have
typed in.
Click on the product you want to add as a related product. You will
see it added to the box below.
Repeat step 4-5 for others product you want to add.
Click on save button
Related products will be added to your product page.

Joomla Template not installing properly

I'm making a custom joomla template. Everytime i try installing it from the back-end, it uploads but doesn't install. I have checked all the directory listings and stuff but can't seem to find what the problem is.
Here is my templatedetails.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 2.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.6/template-install.dtd">
<extension version="2.5" type="template" client="site">
<name></name>
<creationDate></creationDate>
<author></author>
<authorEmail></authorEmail>
<authorUrl></authorUrl>
<copyright>Copyright (C)</copyright>
<version>2.0</version>
<description></description>
<files>
<folder>css</folder>
<folder>images</folder>
<folder>js</folder>
<filename>index.php</filename>
<filename>templateDetails.xml</filename>
</files>
<positions>
<position>message</position>
<position>search</position>
<position>logo</position>
<position>menu</position>
<position>image slider</position>
<position>left menu</position>
<position>right menu</position>
<position>twitter</position>
<position>aboutA</position>
<position>aboutB</position>
<position>aboutC</position>
<position>info</position>
<position>footer</position>
<position>banner</position>
<position>Small-banner</position>
<position>facebook</position>
<position>contact-form</position>
<position>banner-third</position>
</positions>
</extension>
The name and details are all in the zip file.
and here's my index.php
<?php defined( '_JEXEC' ) or die( 'Restricted access' );?>
<body>
<div class="container">
<div class="row">
<h1><img src="images/logo1.png" alt="South Georgian Bay Community Health Center. Every One Matters"/></h1>
</div>
<div class="row">
<section class="sixteen columns">
<jdoc:include type="modules" name="mainmenu" style="xhtml"/>
</section>
</div>
<section class="sixteen columns">
<div id="sliderFrame">
<div id="slider">
<img src="images/image-slider-1.jpg" alt=" " />
<img src="images/image-slider-2.jpg" alt=" " />
<img src="images/image-slider-3.jpg" alt=" " />
<img src="images/image-slider-4.jpg" alt=" " />
<img src="images/image-slider-5.jpg" alt=" "/>
<jdoc:include type="modules" name="slideshow" style="xhtml"/>
</div>
</div>
</section>
</div>
<div class="row">
<section="sixteen columns"><p></p></section>
<section="seven columns"><p></p></section>
</div>
<div class="row">
<section class="twelve columns">
<jdoc:include type="message" />
<jdoc:include type="component" style="xhtml"/>
</section>
<section class="four columns ">
<jdoc:include type="modules" name="twitter" style="xhtml"/>
</section>
</div>
<div class="row">
<section class="five columns">
<jdoc:include type="modules" name="aboutA" style="xhtml"/>
</section>
<section class="five columns">
<jdoc:include type="modules" name="aboutB" style="xhtml"/>
</section>
<section class="five columns">
<jdoc:include type="modules" name="aboutC" style="xhtml"/>
</section>
</div>
<div class="row">
<section class="sixteen columns">
<jdoc:include type="modules" name="footer" style="xhtml"/>
</section>
</div>
</div>
it isn't showing my head section properly for some reason. I am using a grid for the layout.
Could anyone help me out because i've been trying for a while now and can't find a way around.
Please validate your xml.
Change:
section="sixteen columns"
to
section class="sixteen columns"...
regardless if you are using a grid framework or not it always comes down to the URL or href= to you linking to your stylesheets and images directly within the index.php file. This just happened to me 5 minutes ago and it happens to me all the time and I never turn around and look at the big picture.
First of all I don't know why but I think for some odd reason you should or must include a <filename>index.html</filename> blank file.
next
you also need a favicon.ico in your templatedetails and an actual favicon.ico in your root of the template. I do believe this is mandatory or breaks a template or causes an upload directly from install under joomla to malfunction!
The problem that I had is even though my stylesheets seem to be getting called, they really are not being called so what I did and what I will always do in the future when building joomla templates is to replace this in all my references to files in the head or elsewhere.
Lets say you have href="css/bootstrap.min.css" or something. add this
<?php echo $this->baseurl ?>
/templates/
<?php echo $this->template ?>/
to make it
href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/bootstrap.min.css"
if nothing else worked this will and it's a good practice too.
you also cannot! Cannot forget this towards the beginning of your tag <jdoc:include type="head" />
You didn't show all your index.php so I could not tell..

Joomla 2.5 - Is it possibile to load system messages inside jdoc content?

I have the following code:
<div id="content">
<?php if(count($app->getMessageQueue())) { ?>
<jdoc:include type="message" />
<?php } ?>
<jdoc:include type="component" />
</div><!--#content-->
Everything works fine expect when there are error or system generated messages. When they are presented output looks like:
<div id="content">
Some error messages
<h1>Some page title</h1>
<p>Some content</p>
</div><!--#content-->
I want to they looks like:
<div id="content">
<h1>Some page title</h1>
Some error messages
<p>Some content</p>
</div><!--#content-->
So error messages should be below h1 tag and before p tag. How to achieve that without hacking core files?
If am not wrong, just swap the two lines (1st as component and 2nd as message).
<div id="content">
<jdoc:include type="component" />
<?php if(count($app->getMessageQueue())) { ?>
<jdoc:include type="message" />
<?php } ?>
</div><!--#content-->