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>
Related
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 :)
im trying to make a OCmod for opencart 2.0.3.1
and when i try to find in catalog/view/theme/*/template/common/header.tpl
these two parts of html code the script dont find anything in error log its says NOT FOUND.
the first search is that
<search>
<![CDATA[
<?php } ?>
<?php } ?>
]]>
</search>
and the seccond serach if for that
</ul>
</div>
</nav>
both of this searchs not find any thing but i copied and pasted from the original file.
some one can help me to improve this serach whit regex or tell me how ocmod works to serach that?
Here is the sample OCMod code to do more better search in your opencart 2.x version.
<file path="catalog/view/theme/*/template/common/header.tpl">
<operation>
<search><![CDATA[}}]]></search>
<add position="after"><![CDATA[This is test ocmod]]></add>
</operation>
</file>
This is test ocmod text display after } }
Try this kind of code in your ocmod.
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
I'm currently looking for the proper way to work on a theme using the real image of a product and not its thumbnail (identified as $thumb in the default theme).
I have found a abrupt trick by adding a line in the controller file:
$this->data['cover'] = $product_info['image'];
But does anybody have experienced a better method (eg with vqmod) to retrieve these real image data without changing controller content (for using in template pages, such as product.tpl or category.tpl for example)?
With help from members of OpenCart forum, I managed to find a functional solution (using vQmod).
It is thus require to create an .xml file placed in the vqmod/xml folder and containing, for example:
<?xml version="1.0" encoding="utf-8"?>
<modification>
<id>Recover Real Image</id>
<version></version>
<vqmver></vqmver>
<author></author>
<email></email>
<website></website>
<file name="catalog/controller/product/product.php">
<operation>
<search position="after"><![CDATA[
$data['points'] = $product_info['points'];
]]></search>
<add><![CDATA[
$data['picture'] = HTTP_SERVER.'/image/'.$product_info['image'];
]]></add>
</operation>
</file>
</modification>
If product image can not be found and assuming a <default.jpg> is put the root of the <image> folder, the <add> element can be replaced by:
if(empty($product_info['image'])){
$data['picture'] = HTTP_SERVER.'image/default.jpg';
}
else{
$data['picture'] = HTTP_SERVER.'image/'.$product_info['image'];
}
Other possible suggestions, by using:
OCmod can be found here
Image Autosize extension can be found here
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.