Post by nutitout » Sat Feb 06, 2016 4:02 pm

Code: Select all

<modification>
<name><![CDATA[<font color="#0000"><b>Ecomteck - Sold Items - Number Bought The Product</font>]]></name>
<version>2.3.0</version>
<link>http://ecomteck.com</link>
<author>ecomteck@gmail.com</author>
<code>ec_sold_items</code>

<file path="catalog/view/theme/*/template/product/product.tpl">
	<operation>
		<search position="replace"><![CDATA[<?php if ($price) { ?>]]></search>
		<add><![CDATA[
			<?php if(isset($sold_items)) { ?>
			<div class="ec_block_sold_items">
				<div><?php echo sprintf($language->get("text_sold_items"), $sold_items); ?></div>
			</div>
			<?php } ?>
			<?php if ($price) { ?>
		]]></add>
	</operation>
</file>
</modification>

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sat Feb 06, 2016 4:02 pm

with no modifcation to product.php however, it is showing the code twice:

Code: Select all

Stock: Pre-Order
This item has been sold: 1 times
This item has been sold: 1 times
$13.90
?:)

Sorry I couldn't post in 1 piece because captcha is broken lol.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sat Feb 06, 2016 4:42 pm

please try fully use this xml file instead of your's

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by nutitout » Sat Feb 06, 2016 5:31 pm

It gave the original error : o

Code: Select all

Parse error: syntax error, unexpected '$this' (T_VARIABLE), expecting function (T_FUNCTION) in /home/atit/public_html/system/storage/modification/catalog/controller/product/product.php on line 22
hmm.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sat Feb 06, 2016 5:41 pm

With this as the .xml:

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sat Feb 06, 2016 5:45 pm

opencart website is broken and won't let me post.

I'm going to try post my words inside a file and attach it :)

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sat Feb 06, 2016 6:02 pm

I can't post again.

Included in .xml files

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sat Feb 06, 2016 6:03 pm

something not right here, did you use VQMOD and import the XML using Opencart OCMOD installer(Extension Installer)?
the VQMOD is not come from Opencart Package, its can be download from here(please download for opencart) https://github.com/vqmod/vqmod/releases

installation
https://github.com/vqmod/vqmod/wiki/Ins ... n-OpenCart

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by nutitout » Sat Feb 06, 2016 8:28 pm

Yea I did use github's latest VQmod, and yes I did import it using the Extension Installer.

Yes I agree, this is odd lol. The site is http://www.atit.nz and I've cleared the cache etc, disabled and re-enabled the .xml modification and it still works.

You know you're a coder when you try to find out why something is working fine when it's not supposed to ;)

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sat Feb 06, 2016 8:52 pm

Oh.

I did install this.....

http://www.randemsystems.com/support/op ... 9/#msg6199

*red cheeks*.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sat Feb 06, 2016 11:22 pm

nutitout wrote:Yea I did use github's latest VQmod, and yes I did import it using the Extension Installer.

Yes I agree, this is odd lol. The site is http://www.atit.nz and I've cleared the cache etc, disabled and re-enabled the .xml modification and it still works.

You know you're a coder when you try to find out why something is working fine when it's not supposed to ;)
You cannot install vqmod XML using OCMOD installer, all you need to is just copy and paste the XML into the vqmod/xml folder

One more thing is please make sure that you have succesfully install vqmod by visiting
Yourwebsite.com/vqmod/install

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by nutitout » Sun Feb 07, 2016 9:19 am

Yea I checked, it is installed correctly.
You cannot install vqmod XML using OCMOD installer, all you need to is just copy and paste the XML into the vqmod/xml folder
I don't understand, the ocmod.xml file uploaded and installed fine, and then did work, but I cannot figure out why.

The other thing I was wondering is that when I downloaded the original ecsolditems.2.0.0.ocmod.xml there seemed to be 2 files. 1 was the ocmod.xml and another was in an 'upload' directory but that was just an .xml file. This is the second vqmod I've seen that has two files like this. The files are identical. Why is that?

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sun Feb 07, 2016 3:44 pm

i once upload a XML on this post http://forum.opencart.com/viewtopic.php ... 20#p602341
there are no need to understand anything. all you need to do is just have a vqmod installed properly then download the new 1.xml and put that file on your "public_html/vqmod/xml/" folder and all done. you may also delete the ocmod you upload using Extension Installer, and one more thing is as you saying on your first post, you were using VQMOD not OCMOD. and i give a solution which i dont seem you would like to follow. so there's no point on any other answer. just FYI VQMOD and OCMOD is two different thing, OCMOD was created as a simplified cut down version of VQMOD. good luck then

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by nutitout » Sun Feb 07, 2016 5:16 pm

Oh I see.

So OCMOD and VQMOD, I thought they were the same except, VQMOD you upload manually, and OCMOD you can install using the Extension Installer?

Are they very different or is that the only difference at this point?

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sun Feb 07, 2016 6:31 pm

Found something.

When I uploaded the original .xml I must've uploaded the attached file.

Code: Select all

<modification>
	<id>VQMod Ecomteck - Sold Items - Number Bought the product</id>
	<version>1.0.0</version>
	<vqmver>2.3.0</vqmver>
	<author>ecomteck@gmail.com (http://ecomteck.com)</author>
	<file path="catalog/language/*/product/product.php">
	   <operation error="log">
		  <search position="replace"><![CDATA[$_['text_search']              = 'Search';]]></search>
		  <add><![CDATA[
			 $_['text_sold_items'] = '<span class="sold_total_sold">Sold: </span><span class="sold_total_number"><b>%s</b> <span></span></span>';
			 $_['text_search']              = 'Search';
		  ]]></add>
	   </operation>
	</file>
	<file name="catalog/view/theme/*/template/product/product.tpl">
		<operation  error="abort">
			<search position="before"><![CDATA[<?php if ($price) { ?>]]></search>
			<add><![CDATA[
				<?php if(isset($sold_items)) { ?>
				<div class="ec_block_sold_items">
					<div><?php echo sprintf($language->get("text_sold_items"), $sold_items); ?></div>
				</div>
				<?php } ?>
			]]></add>
		</operation>
	</file>
	<file name="catalog/controller/product/product.php">
		<operation  error="abort">
			<search position="before"><![CDATA[public function review() {]]></search>
			<add><![CDATA[
					protected function getTotalBought($product_id, $order_status_id = 0)
					{
						$bought = 0;
						$filter_status = " AND o.order_status_id > 0";
						if($order_status_id ) {
							$filter_status = " AND o.order_status_id IN (".implode(",",$order_status_id).")";
						}
						$query = $this->db->query("SELECT sum(quantity) as `total` FROM `" . DB_PREFIX . "order_product` op
							LEFT JOIN `".DB_PREFIX."order` AS o ON op.order_id = o.order_id WHERE op.product_id = ".$product_id.$filter_status);

						if($query->num_rows){
							return $query->row['total'];
						}
						return 0;
					}
			]]></add>
		</operation>
		<operation  error="abort">
			<search position="after"><![CDATA[if ($product_info) {]]></search>
			<add><![CDATA[
				$data['language'] = $this->language;
				$data['sold_items'] = $this->getTotalBought($product_info['product_id']);
			]]></add>
		</operation>
	</file>
</modification>
Working on making this work for featured.tpl but I'm unsure if I need to somehow call this function again or, if I'm on the right track? Getting somewhere though, stoked :D!

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sun Feb 07, 2016 8:33 pm

This is where I'm at at the moment.

Product.tpl is working and showing "Sold: %s" correctly on the products page.

Featured.tpl is not working, and with testing has shown me that $solditems is not set.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by Everest4142 » Tue Mar 06, 2018 3:16 pm

Please I need help with rectifying this

Parse error: syntax error, unexpected 'Error' (T_STRING), expecting ',' or ')' in /home/allcheap/ocartdata/storage/modification/system/library/template/twig.php on line 46

<?php
namespace Template;
final class Twig {
private $twig;
private $data = array();

public function __construct() {
// include and register Twig auto-loader
include_once(DIR_SYSTEM . 'library/template/Twig/Autoloader.php');

\Twig_Autoloader::register();
}

public function set($key, $value) {
$this->data[$key] = $value;
}

public function render($template, $cache = false) {
// specify where to look for templates

$loader = new \Twig_Loader_Filesystem();

if (defined('DIR_CATALOG') && is_dir(DIR_MODIFICATION . 'admin/view/template/')) {
$loader->addPath(DIR_MODIFICATION . 'admin/view/template/');
} elseif (is_dir(DIR_MODIFICATION . 'catalog/view/theme/')) {
$loader->addPath(DIR_MODIFICATION . 'catalog/view/theme/');
}

$loader->addPath(DIR_TEMPLATE);

// initialize Twig environment
$config = array('autoescape' => false);

if ($cache) {
$config['cache'] = DIR_CACHE;
}

$this->twig = new \Twig_Environment($loader, $config);

try {
// load template
$template = $this->twig->loadTemplate($template . '.twig);

return $template->render($this->data);
} catch (Exception $e) {
trigger_error('Error: Could not load template ' . $template . '!');
exit();
}
}
}

Newbie

Posts

Joined
Tue Feb 20, 2018 8:00 pm
Who is online

Users browsing this forum: No registered users and 9 guests