Post by nutitout » Sat Feb 06, 2016 10:45 am

Hi people :)

I'm launching tonight and trying to get a vqmod addition in before it goes live.

If someone can see the issue right away I'd really appreciate it. This is the error:

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 28
and this is the xml:

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/language/*/product/product.php">
	<operation>
		<search position="replace"><![CDATA[$_['text_search']              = 'Search';]]></search>
		<add><![CDATA[
			$_['text_sold_items'] = 'This item has been sold: <span class="sold_total"><b>%s</b> <span>times</span></span>';
			$_['text_search']              = 'Search';
		]]></add>
	</operation>
</file>
<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>
<file path="catalog/controller/product/product.php">
	<operation>
		<search position="before"><![CDATA[public function index() {]]></search>
		<add><![CDATA[
			protected function getTotalBought($product_id, $order_status_id = 0){
			
			$this->load->language('product/product');
			$this->load->model('catalog/product');
			
			$data['language'] = $this->language->get('language');
			$data['sold_items'] = $this->getTotalBought($product_info['product_id']);
			
				$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>
</file>
</modification>
Brilliant if we can get running! Thanks :)

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sat Feb 06, 2016 12:19 pm

Code: Select all

<file path="catalog/view/theme/*/template/product/product.tpl">
   <operation error="log">
      <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($text_sold_items, $sold_items); ?></div>
         </div>
         <?php } ?>
         <?php if ($price) { ?>
      ]]></add>
   </operation>
</file>
<file path="catalog/controller/product/product.php">
   <operation error="log">
      <search position="before"><![CDATA[if ($product_info) {]]></search>
      <add><![CDATA[$data['text_sold_items'] = $this->language->get('text_sold_items');
	  $data['sold_items'] = $this->getTotalBought($product_info['product_id']) / 2;]]></add>
   </operation>
   <operation error="log">
      <search position="before"><![CDATA[public function index() {]]></search>
      <add><![CDATA[
         public 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>
</file>
$data['sold_items'] = $this->getTotalBought($product_info['product_id']) / 2; i'm not pretty sure why but you need to divide this into 2 if you're using OC2.1.0.2. below than this version remove the " / 2"

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 ocart777 » Sat Feb 06, 2016 12:24 pm

nutitout wrote:

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 28
one more think are this error, you're using vqmod but you getting an acmod, perhaps mod duplication?

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 12:58 pm

The " / 2 " isn't actually in my code. It seems to only be on this website -.^
one more think are this error, you're using vqmod but you getting an acmod, perhaps mod duplication?
what's a mod duplication? I only have ViethemesCSS and this installed, if that means anything :)?

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sat Feb 06, 2016 1:16 pm

actually i'm asking you to use those code i write to your XML(vqmod) which only for
"catalog/view/theme/*/template/product/product.tpl" and "catalog/controller/product/product.php"

;)

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 ocart777 » Sat Feb 06, 2016 1:22 pm

here what i come with
Clipboard01.jpg

Clipboard01.jpg (109.44 KiB) Viewed 6982 times


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 1:28 pm

Oh I see! I added the code but same "$this" error.

and here's the new code:

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/language/*/product/product.php">
	<operation>
		<search position="replace"><![CDATA[$_['text_search']              = 'Search';]]></search>
		<add><![CDATA[
			$_['text_sold_items'] = 'This item has been sold: <span class="sold_total"><b>%s</b> <span>times</span></span>';
			$_['text_search']              = 'Search';
		]]></add>
	</operation>
</file>
<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>
<file path="catalog/controller/product/product.php">
	<operation>
		<search position="before"><![CDATA[public function index() {]]></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>
		<search position="after"><![CDATA[if ($product_info) {]]></search>
		<add><![CDATA[
			$data['language'] = $this->language->get('language');
			$data['sold_items'] = $this->getTotalBought($product_info['product_id']) / 2;
		]]></add>
	</operation>
</file>
</modification>
Also thanks for taking a look matey :) I'm just trying to be more flash but I'd love to get this working lol.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

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

yes! How do you do that? I tried the code, it had same error.

How can I get this :D?

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sat Feb 06, 2016 1:53 pm

nutitout wrote:yes! How do you do that? I tried the code, it had same error.

How can I get this :D?
nutitout wrote: 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 28
[/code]
the above error has something to do with OCMOD. try go to admin dashboard - > extension -> modification
1. press the clear button
2. press the refresh button

after all good. recheck at your front end product page

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 2:07 pm

Thanks :) It's still having trouble, I tried your code, here is all of it:

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 error="log">
      <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($text_sold_items, $sold_items); ?></div>
         </div>
         <?php } ?>
         <?php if ($price) { ?>
      ]]></add>
   </operation>
</file>
<file path="catalog/controller/product/product.php">
   <operation error="log">
      <search position="before"><![CDATA[if ($product_info) {]]></search>
      <add><![CDATA[$data['text_sold_items'] = $this->language->get('text_sold_items');
     $data['sold_items'] = $this->getTotalBought($product_info['product_id']) / 2;]]></add>
   </operation>
   <operation error="log">
      <search position="before"><![CDATA[public function index() {]]></search>
      <add><![CDATA[
         public 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>
</file>
</modification>
and I tried to modify my last code here too, but still same error (Line 22 now):

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/language/*/product/product.php">
   <operation>
      <search position="replace"><![CDATA[$_['text_search']              = 'Search';]]></search>
      <add><![CDATA[
         $_['text_sold_items'] = 'This item has been sold: <span class="sold_total"><b>%s</b> <span>times</span></span>';
         $_['text_search']              = 'Search';
      ]]></add>
   </operation>
</file>
<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>
<file path="catalog/controller/product/product.php">
   <operation>
      <search position="before"><![CDATA[public function index() {]]></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>
      <search position="after"><![CDATA[if ($product_info) {]]></search>
      <add><![CDATA[
         $data['language'] = $this->language->get('language');
         $data['sold_items'] = $this->getTotalBought($product_info['product_id']) / 2;
      ]]></add>
   </operation>
</file>
</modification>
Lucky I copied this message because that CAPTCHA CHECKER deletes it every 3 or so times I post here. Someone may want to look at that.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

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

if you're only use this mod http://www.opencart.com/index.php?route ... n_id=20565 and vqmod you created then for sure it doesn't even related to

Code: Select all

system/storage/modification/catalog/controller/product/product.php
you can try delete this file(make a backup if necessary) i scare that this was cause by the theme you use
would be good if you can post the 28 line of the file

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 2:48 pm

I deleted it and now when I click on a product on the website, the page says:

"The page you requested cannot be found!
The page you requested cannot be found."

0.0 lol.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sat Feb 06, 2016 2:48 pm

This is lines: 20 - 24, line 22 is the middle code:

Code: Select all

			$parts = explode('_', (string)$this->request->get['path']);

			$category_id = (int)array_pop($parts);

			foreach ($parts as $path_id) {

The problem has changed to line 22 btw :)

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

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sat Feb 06, 2016 3:07 pm

i suppose you're using custom theme, try change back to default theme and then
delete any file from system/storage/modification/ except index.html

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 3:20 pm

It is default theme lol.

That file (catalog/controller/product/product.php) came with default install.

This is odd.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by ocart777 » Sat Feb 06, 2016 3:26 pm

(catalog/controller/product/product.php)
and
(system/storage/modification/catalog/controller/product/product.php)

isn't the same and i'm asking to delete all except index.html from sytem/storage/modification/ and not from original file
like i said, make a backup if necessary please

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 3:40 pm

and i'm asking to delete all except index.html from sytem/storage/modification/ and not from original file
like i said, make a backup if necessary pleas
There was nothing in there but index.html : o
(catalog/controller/product/product.php)
and
(system/storage/modification/catalog/controller/product/product.php)
I see what you mean now! here is the result. We're getting closer :D!

Code: Select all

Fatal error: Cannot redeclare ControllerProductProduct::getTotalBought() in /home/atit/public_html/vqmod/vqcache/vq2-vqmod_vqcache_vq2-catalog_controller_product_product.php on line 591

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sat Feb 06, 2016 3:51 pm

aaand captcha deleted my post again. I'll just re-do the last 10mins :)

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

Post by nutitout » Sat Feb 06, 2016 3:54 pm

Captcha is broken and won't let me paste anything with code in it.

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am

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

I have it, nearly!

system/storage/modification/catalog/view/theme/default/template/product/product.tpl exists. Is it supposed to?

and I only have this now:

User avatar
New member

Posts

Joined
Tue Jun 24, 2014 12:42 am
Who is online

Users browsing this forum: No registered users and 10 guests