Vqmod not adding script in opencart files - opencart

I have created a module for opencart.Now i have to change some default template files and php file so i used VQMOD .Now VQMOD Manager is running correctly but not adding the script that i have added.
Sample code below.
<modification>
<id>demo</id>
<version>1.1</version>
<vqmver>2.3.0</vqmver>
<author>http://www.demo.com</author>
<file path="admin/controller/common/" name="header.php">
<operation>
<search position="after">
<![CDATA[$this->data['text_zone'] = $this->language->get('text_zone');]]>
</search>
<add>
<![CDATA[
$this -> data['text_design_category'] = $this -> language -> get('text_design_category');
$this -> data['text_rawproduct'] = $this -> language -> get('text_rawproduct');
$this -> data['text_font'] = $this -> language -> get('text_font');
$this -> data['text_color'] = $this -> language -> get('text_color');
$this -> data['text_screen_color'] = $this -> language -> get('text_screen_color');
$this -> data['text_productdesigner'] = 'Product Designer';
]]>
</add>
</operation>
</file>
</modification>

You need to only replace this line <file name="admin/controller/common/header.php">
instead of <file path="admin/controller/common/" name="header.php">
Try this below code.
<modification>
<id>demo</id>
<version>1.1</version>
<vqmver>2.3.0</vqmver>
<author>http://www.demo.com</author>
<file name="admin/controller/common/header.php">
<operation>
<search position="after">
<![CDATA[$this->data['text_zone'] = $this->language->get('text_zone');]]>
</search>
<add>
<![CDATA[
$this -> data['text_design_category'] = $this -> language -> get('text_design_category');
$this -> data['text_rawproduct'] = $this -> language -> get('text_rawproduct');
$this -> data['text_font'] = $this -> language -> get('text_font');
$this -> data['text_color'] = $this -> language -> get('text_color');
$this -> data['text_screen_color'] = $this -> language -> get('text_screen_color');
$this -> data['text_productdesigner'] = 'Product Designer';
]]>
</add>
</operation>
</file>
</modification>

Related

Create Sitecore Item from Existing template

I am new to sitecore, when I try to create new item for existing template. I am unable to call my master database.Need some guide for how to create new item in sitecore and how to show it on my running sitecore page? Just need some hint regarding flow of after creation how to render it on existing sitecore page.
<configuration type="Sitecore.Search.SearchConfiguration, Sitecore.Kernel" singleInstance="true">
<indexes hint="list:AddIndex">
<index id="system" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">__system</param>
<Analyzer ref="search/analyzer" />
<locations hint="list:AddCrawler">
<core type="Sitecore.Search.Crawlers.DatabaseCrawler,Sitecore.Kernel">
<Database>core</Database>
<Root>/sitecore/content</Root>
<include hint="list:IncludeTemplate">
<application>{EB06CEC0-5E2D-4DC4-875B-01ADCC577D13}</application>
</include>
<Tags>application</Tags>
<Boost>2.0</Boost>
</core>
<core-controlpanel type="Sitecore.Search.Crawlers.DatabaseCrawler,Sitecore.Kernel">
<Database>core</Database>
<Root>/sitecore/content/applications/control panel</Root>
<include hint="list:IncludeTemplate">
<taskoption>{BDB6FA46-2F76-4BDE-8138-52B56C2FC47E}</taskoption>
</include>
<Tags>taskoption</Tags>
<Boost>1.9</Boost>
</core-controlpanel>
<master type="Sitecore.Search.Crawlers.DatabaseCrawler, Sitecore.Kernel">
<Database>master</Database>
<Tags>master content</Tags>
</master>
</locations>
</index>
</indexes>
</configuration>
I will write the code I usually execute:
Database database = Database.GetDatabase("master");
Item rooItem = database.GetItem(new ID(parentItemId));
if (rootItem == null) return null;
TemplateID pageTemplateId = new TemplateID(new ID(templateId));
string validName = ItemUtil.ProposeValidItemName(name);
using (new Sitecore.SecurityModel.SecurityDisabler())
{
Item newItem = rootItem.Add(validName, pageTemplateId);
if (newItem == null) return null;
//TODO: publish item
}
rootItem could be the home item
templateId will be the id of your page template (remember this page should have layout and renderings defined)

Product price excl tax in order histroy info page (Opencart 1.5.6.4)

Is there a simple way to show the price without tax instead of incl on the order histroy page in opencart 1.5.6.4? I Managed to "fix" it everywhere else.
Screendump opencart 1.5.6.4.
Can anybody tell me how to change this?
Thank you!
<file name="catalog/controller/account/order.php">
<operation>
<search position="replace"><![CDATA['price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),]]></search>
<add><![CDATA['price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']),]]></add>
</operation>
<operation>
<search position="replace"><![CDATA['total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']),]]></search>
<add><![CDATA['total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']),]]></add>
</operation>
</file>
Done :)

how to display future products in opencart

products in open cart script doesn't show up in front end page when i add product and set the date to the future
am trying to display future products S i want to know how can i do that is there anyway i can do that,i do search a lot for answer to that question but all i found is xml file need vqmod system but it's not working too . so please guys am trying to display future products on homepage
here's then answer which didn't work
<modification>
<id><![CDATA[Products with future available date become able to show in store and be purchased]]></id>
<version><![CDATA[1.0.0]]></version>
<vqmver><![CDATA[2.0.0]]></vqmver>
<author><![CDATA[angeloop]]></author>
<file name="catalog/model/catalog/product.php">
<operation>
<search position="after"><![CDATA['p.date_added']]></search>
<add><![CDATA[, 'p.date_available']]></add>
</operation>
<operation>
<search position="replace"><![CDATA[AND p.date_available <= NOW()]]> </search>
<add><![CDATA[]]></add>
</operation>
</file>
<file name="system/library/cart.php">
<operation>
<search position="replace"><![CDATA[AND p.date_available <= NOW()]]></search>
<add><![CDATA[]]></add>
</operation>
</file>
</modification>
I have created a module for it.
Go to the link below
Coming soon products module for OpenCart
Download the modules and set the modules which will show future products or coming soon products

How to add custom words behind product price

I am trying to figure out how to add "Per Square Feet" behind the Product Price. It should be only applied to selected products - not to all. Any help is appreciated.
This is the screenshot for reference
Thank you for the photo it helped a lot. I suggest adding this into vqmod/vqcache. For more information on VQmod look here: https://code.google.com/p/vqmod/. If not you can just take the HTML, PHP, and Query code and put it directly in your core files.
View:
<file name="catalog/view/theme/*/template/product/product.tpl"> // where it will insert the below code
<operation>
<search position="before"><![CDATA[<?php if ($tax) { ?>]]></search> // this places your code before the code in the CDATA[....what ever is here....]
<add><![CDATA[ // the below code is what you are adding
<?php if isset($pricePerSqFt) { ?>
<p><?php echo $pricePerSqFt; ?></p>]]></add>
</operation>
</file>
Controller:
$this->load->model('catalog/product');
$this->data['pricePerSqFt'] = $this->model_catalog_product->getData();
Model:
<file name="catalog/model/catalog/product.php">
<operation>
<search position="after"><![CDATA[class ModelCatalogProduct extends Model {]]></search>
<add>
<![CDATA[
public function getData() {
$query = $this->db->query("SELECT what_data_you_want FROM table_name"); // will grab the data from database
if (isset($query)) {
return $query;
}else{
return NULL;
}
}
]]>
</add>
</operation>
</file>

Opencart - how do i add submenu in admin panel

I want to add a sub-menu in Opencart admin panel .
I was saw this link, but it didn't really help .
any help will be appropriated .
I just find it out and here the solution :
because we should not modify the core and only solution is VQMOD , you should add some line to your xml file witch there is in xml folder :
<file name="admin/controller/common/header.php">
<operation>
<search position="after"><![CDATA[$this->data['text_backup'] = $this->language->get('text_backup');]]></search>
<add><![CDATA[ $this->data['text_export'] = "sms";]]></add>
</operation>
<operation>
<search position="after"><![CDATA[$this->data['backup'] = $this->url->link('tool/backup', 'token=' . $this->session->data['token'], 'SSL');]]></search>
<add><![CDATA[ $this->data['export'] = $this->url->link('tool/export', 'token=' . $this->session->data['token'], 'SSL');]]></add>
</operation>
</file>
it add menu to system menu .
Hope it Helps.