Current Path : /var/www/storage2/upload/temp-FS69xPbvMYEsK4KSwbHpUgTfhcl3lVKl/ |
Current File : /var/www/storage2/upload/temp-FS69xPbvMYEsK4KSwbHpUgTfhcl3lVKl/install.xml |
<modification> <id>Fixed Price - OpenCart 2.3.x core file modifications</id> <version>1.1.9.3</version> <vqmver>1.1.0</vqmver> <author>yolanda_txw@hotmail.com</author> <name>Fixed Price</name> <link>http://www.sunflowerbiz.com</link> <code>sunflowerbiz_fixedprice_1201_ocmod</code> <file path="catalog/controller/product/product.php"> <operation> <search><![CDATA[foreach ($discounts as $discount) {]]></search> <add position="replace"><![CDATA[ foreach ($discounts as $discount) { //Sun0703 start //add discount function sof $useorg = 1; $query3 = $this->db->query("Select price from " . DB_PREFIX . "product_discount_prices where code='".$this->session->data['currency']."' and product_discount_id='".$discount['product_discount_id']."'"); foreach($query3->rows as $results) { if($results['price']>0){ $discount['price'] = $results['price'];$useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $discount['price'] *= ($result4['value']); } } if($discount['price']<=0){ $query3 = $this->db->query("Select code,price from " . DB_PREFIX . "product_discount_prices where product_discount_id='".$discount['product_discount_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $discount['price'] = $tprice * ($currcode_value/$productcode_value); } } //add discount function eof ]]></add> </operation> </file> <file path="catalog/model/catalog/product.php"> <operation error="skip"> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[//$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit); $product_data = false;]]></add> </operation> <operation error="skip"> <search><![CDATA[$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit);]]></search> <add position="replace"><![CDATA[//$product_data = $this->cache->get('product.bestseller.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit); $product_data = false;]]></add> </operation> <operation > <search index="0"><![CDATA[if ($query->num_rows) {]]></search> <add position="replace" ><![CDATA[ if ($query->num_rows) { //Sun0703 start if(isset($_SESSION['use_fixed_price'])){ $useorg = 1; $query2s = $this->db->query("SELECT product_special_id FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = '".$query->row['product_id']."' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id'). "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1"); if(!isset($query2s->row['product_special_id'])) $query2s->row['product_special_id']=0; $query3d = $this->db->query("SELECT product_discount_id FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = '".$query->row['product_id']."' AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1"); if(!isset($query3d->row['product_discount_id'])) $query3d->row['product_discount_id']=0; $query3 = $this->db->query("Select products_price from " . DB_PREFIX . "product_fixed_prices where code='".$this->session->data['currency']."' and product_id='".$query->row['product_id']."'"); foreach($query3->rows as $results) { if($results['products_price']>0){ $query->row['price'] = $results['products_price']; $useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $query->row['price'] *= ($result4['value']); } } /*if($query->row['special']>0){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $query->row['special'] *= ($result4['value']); } }*/ if($query->row['price']<=0){ $query3 = $this->db->query("Select code,products_price from " . DB_PREFIX . "product_fixed_prices where product_id='".$query->row['product_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['products_price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['products_price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $query->row['price'] = $tprice * ($currcode_value/$productcode_value); } } //add special function sof $useorg = 1; $query3 = $this->db->query("Select price from " . DB_PREFIX . "product_special_prices where code='".$this->session->data['currency']."' and product_special_id='".$query2s->row['product_special_id']."'"); foreach($query3->rows as $results) { if($results['price']>0){ $query->row['special'] = $results['price'];$useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $query->row['special'] *= ($result4['value']); } } if($query->row['special']<=0){ $query3 = $this->db->query("Select code,price from " . DB_PREFIX . "product_special_prices where product_special_id='".$query2s->row['product_special_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $query->row['special'] = $tprice * ($currcode_value/$productcode_value); } } //add special function eof //add discount function sof $useorg = 1; $query3 = $this->db->query("Select price from " . DB_PREFIX . "product_discount_prices where code='".$this->session->data['currency']."' and product_discount_id='".$query3d->row['product_discount_id']."'"); foreach($query3->rows as $results) { if($results['price']>0){ $query->row['discount'] = $results['price'];$useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $query->row['discount'] *= ($result4['value']); } } if($query->row['discount']<=0){ $query3 = $this->db->query("Select code,price from " . DB_PREFIX . "product_discount_prices where product_discount_id='".$query3d->row['product_discount_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $query->row['discount'] = $tprice * ($currcode_value/$productcode_value); } } //add discount function eof } //Sun0703 end ]]></add> </operation> <operation> <search><![CDATA[foreach ($product_option_value_query->rows as $product_option_value) {]]></search> <add position="replace"><![CDATA[ foreach ($product_option_value_query->rows as $product_option_value) { //Sun0703 start if(isset($_SESSION['use_fixed_price'])){ $useorg = 1; $query3 = $this->db->query("Select option_price from " . DB_PREFIX . "product_option_fixed_prices where code='".$this->session->data['currency']."' and product_option_value_id='".$product_option_value['product_option_value_id']."'"); foreach($query3->rows as $results) { if($results['option_price']>0){ $product_option_value['price'] = $results['option_price']; $useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $product_option_value['price'] *= ($result4['value']); } } if($product_option_value['price']<=0){ $query3 = $this->db->query("Select code,option_price from " . DB_PREFIX . "product_option_fixed_prices where product_option_value_id='".$product_option_value['product_option_value_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['option_price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['option_price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $product_option_value['price'] = $tprice * ($currcode_value/$productcode_value); } } } //Sun0703 end ]]></add> </operation> <operation> <search><![CDATA[return array(]]></search> <add position="replace"><![CDATA[ if(isset($query2s->row['product_special_id'])) $q2spsid=$query2s->row['product_special_id']; else $q2spsid=0; if(isset($query3d->row['product_discount_id'])) $q3dpdid=$query3d->row['product_discount_id']; else $q3dpdid=0; return array( 'product_special_id'=>$q2spsid, 'product_discount_id'=>$q3dpdid, ]]></add> </operation> <operation> <search><![CDATA[$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit);]]></search> <add position="after"><![CDATA[ //Sun0703 start $product_data = false; //Sun0703 end ]]></add> </operation> </file> <file path="catalog/model/affiliate/transaction.php"> <operation> <search index="1"><![CDATA[return $query->row['total'];]]></search> <add position="replace" ><![CDATA[ //Sun0703 start if(isset($_SESSION['use_fixed_price'])){ if($query->row['total']>0){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $query->row['total'] *= ($result4['value']); } } } //Sun0703 end return $query->row['total']; ]]></add> </operation> </file> <file path="system/library/cart/customer.php"> <operation> <search index="1"><![CDATA[return $query->row['total'];]]></search> <add position="replace" ><![CDATA[ //Sun0703 start if(isset($_SESSION['use_fixed_price'])){ if($query->row['total']>0){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $query->row['total'] *= ($result4['value']); } } } //Sun0703 end return $query->row['total']; ]]></add> </operation> </file> <file path="system/library/cart/currency.php"> <operation> <search><![CDATA[foreach ($query->rows as $result) {]]></search> <add position="after"><![CDATA[if(isset($_SESSION['use_fixed_price'])) $result['value'] = '1';]]></add> </operation> <operation> <search><![CDATA[$this->language = $registry->get('language');]]></search> <add position="after"><![CDATA[ $sql = "SELECT * FROM " . DB_PREFIX . "setting where store_id='0' and `key` in ('fixed_prices' ,'config_currency')"; $query3 = $this->db->query($sql); $tm = 0;$cc='USD'; foreach ($query3->rows as $setting) { if( $setting['key']=='fixed_prices') $tm = $setting['value']; if( $setting['key']=='config_currency') $cc = $setting['value']; } if(!isset($_SESSION)) session_start(); if($tm) $_SESSION['use_fixed_price'] = 1; else unset($_SESSION['use_fixed_price']); if(isset($_SESSION['default']['currency'])){ $this->session->data['currency']=$_SESSION['default']['currency']; }else $this->session->data['currency']=$cc; ]]></add> </operation> </file> <file path="system/library/cart/cart.php"> <operation> <search><![CDATA[if ($product_special_query->num_rows) {]]></search> <add position="after"><![CDATA[ //Sun0703 start if(isset($_SESSION['use_fixed_price'])){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $product_special_query->row['price']*= ($result4['value']); } } //Sun0703 end ]]></add> </operation> <operation> <search><![CDATA[$price = $product_discount_query->row['price'];]]></search> <add position="before"><![CDATA[ //Sun0703 start if(isset($_SESSION['use_fixed_price'])){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $product_discount_query->row['price']*= ($result4['value']); } } //Sun0703 end ]]></add> </operation> <operation> <search><![CDATA[$price = $product_query->row['price'];]]></search> <add position="after"><![CDATA[ //Sun0703 start if(isset($_SESSION['use_fixed_price'])){ $useorg = 1; $query3 = $this->db->query("Select products_price from " . DB_PREFIX . "product_fixed_prices where code='".$this->session->data['currency']."' and product_id='".$product_query->row['product_id']."'"); foreach($query3->rows as $results) { if($results['products_price']>0){ $price = $results['products_price']; $useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $price *= ($result4['value']); } } if($price<=0){ $query3 = $this->db->query("Select code,products_price from " . DB_PREFIX . "product_fixed_prices where product_id='".$product_query->row['product_id']."'"); $tprice = 0; $hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['products_price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['products_price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $price = $tprice * ($currcode_value/$productcode_value); } } } //Sun0703 end ]]></add> </operation> <operation> <search><![CDATA[$option_value_query = $this->db->query("SELECT pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$value . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");]]></search> <add position="replace" ><![CDATA[ //Sun0703 start $option_value_query = $this->db->query("SELECT pov.product_option_value_id,pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$value . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'"); if(isset($_SESSION['use_fixed_price'])){ $useorg = 1; $query3 = $this->db->query("Select option_price from " . DB_PREFIX . "product_option_fixed_prices where code='".$this->session->data['currency']."' and product_option_value_id='".$option_value_query->row['product_option_value_id']."'"); foreach($query3->rows as $results) { if($results['option_price']>0){ $option_value_query->row['price'] = $results['option_price']; $useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $option_value_query->row['price'] *= ($result4['value']); } } if($option_value_query->row['price']<=0){ $query3 = $this->db->query("Select code,option_price from " . DB_PREFIX . "product_option_fixed_prices where product_option_value_id='".$option_value_query->row['product_option_value_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['option_price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['option_price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $option_value_query->row['price'] = $tprice * ($currcode_value/$productcode_value); } } } //Sun0703 end ]]></add> </operation> <operation> <search><![CDATA[$option_value_query = $this->db->query("SELECT pov.option_value_id, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix, ovd.name FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (pov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");]]></search> <add position="replace" ><![CDATA[ //Sun0703 start $option_value_query = $this->db->query("SELECT pov.product_option_value_id,pov.option_value_id, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix, ovd.name FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (pov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'"); if(isset($_SESSION['use_fixed_price'])){ $useorg = 1; $query3 = $this->db->query("Select option_price from " . DB_PREFIX . "product_option_fixed_prices where code='".$this->session->data['currency']."' and product_option_value_id='".$option_value_query->row['product_option_value_id']."'"); foreach($query3->rows as $results) { if($results['option_price']>0){ $option_value_query->row['price'] = $results['option_price']; $useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $option_value_query->row['price'] *= ($result4['value']); } } if($option_value_query->row['price']<=0){ $query3 = $this->db->query("Select code,option_price from " . DB_PREFIX . "product_option_fixed_prices where product_option_value_id='".$option_value_query->row['product_option_value_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['option_price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['option_price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $option_value_query->row['price'] = $tprice * ($currcode_value/$productcode_value); } } } //Sun0703 end ]]></add> </operation> <operation error="skip"> <search><![CDATA[$option_value_query = $this->db->query("SELECT pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");]]></search> <add position="replace" ><![CDATA[ //Sun0703 start $option_value_query = $this->db->query("SELECT pov.product_option_value_id,pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'"); if(isset($_SESSION['use_fixed_price'])){ $useorg = 1; $query3 = $this->db->query("Select option_price from " . DB_PREFIX . "product_option_fixed_prices where code='".$this->session->data['currency']."' and product_option_value_id='".$option_value_query->row['product_option_value_id']."'"); foreach($query3->rows as $results) { if($results['option_price']>0){ $option_value_query->row['price'] = $results['option_price']; $useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $option_value_query->row['price'] *= ($result4['value']); } } if($option_value_query->row['price']<=0){ $query3 = $this->db->query("Select code,option_price from " . DB_PREFIX . "product_option_fixed_prices where product_option_value_id='".$option_value_query->row['product_option_value_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['option_price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['option_price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $option_value_query->row['price'] = $tprice * ($currcode_value/$productcode_value); } } } //Sun0703 end ]]></add> </operation> <operation> <search><![CDATA[SELECT price FROM " . DB_PREFIX . "product_special]]></search> <add position="replace"><![CDATA[SELECT product_special_id,price FROM " . DB_PREFIX . "product_special]]></add> </operation> <operation> <search><![CDATA[$price = $product_special_query->row['price'];]]></search> <add position="replace"><![CDATA[$price = $product_special_query->row['price']; if(isset($_SESSION['use_fixed_price'])){ $useorg = 1; $query3 = $this->db->query("Select price from " . DB_PREFIX . "product_special_prices where code='".$this->session->data['currency']."' and product_special_id='".$product_special_query->row['product_special_id']."'"); foreach($query3->rows as $results) { if($results['price']>0){ $price = $results['price'];$useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $price *= ($result4['value']); } } if($price<=0){ $query3 = $this->db->query("Select code,price from " . DB_PREFIX . "product_special_prices where product_special_id='".$product_special_query->row['product_special_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $price = $tprice * ($currcode_value/$productcode_value); } } } ]]></add> </operation> <operation> <search><![CDATA[SELECT price FROM " . DB_PREFIX . "product_discount]]></search> <add position="replace"><![CDATA[SELECT product_discount_id,price FROM " . DB_PREFIX . "product_discount]]></add> </operation> <operation> <search><![CDATA[$price = $product_discount_query->row['price'];]]></search> <add position="replace"><![CDATA[$price = $product_discount_query->row['price']; if(isset($_SESSION['use_fixed_price'])){ $useorg = 1; $query3 = $this->db->query("Select price from " . DB_PREFIX . "product_discount_prices where code='".$this->session->data['currency']."' and product_discount_id='".$product_discount_query->row['product_discount_id']."'"); foreach($query3->rows as $results) { if($results['price']>0){ $price = $results['price'];$useorg = 0; } } if($useorg){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $price *= ($result4['value']); } } if($price<=0){ $query3 = $this->db->query("Select code,price from " . DB_PREFIX . "product_discount_prices where product_discount_id='".$product_discount_query->row['product_discount_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->session->data['currency'];$pc=array(); foreach($query3->rows as $results) { if($results['price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $price = $tprice * ($currcode_value/$productcode_value); } } } ]]></add> </operation> </file> <file path="system/startup.php"> <operation> <search><![CDATA[// Helper]]></search> <add position="replace"><![CDATA[ // Helper /* $db3 = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE); // Settings $sql = "SELECT * FROM " . DB_PREFIX . "setting where store_id='0'"; $query3 = $db3->query($sql); $tm = 0;$cc='USD'; foreach ($query3->rows as $setting) { if( $setting['key']=='fixed_prices') $tm = $setting['value']; if( $setting['key']=='config_currency') $cc = $setting['value']; } if(!isset($_SESSION)) session_start(); if($tm) $_SESSION['use_fixed_price'] = 1; else unset($_SESSION['use_fixed_price']); */ ]]></add> </operation> </file> <file path="admin/model/catalog/product.php"> <operation> <search index="0"><![CDATA[$this->cache->delete('product');]]></search> <add position="replace"><![CDATA[ //sun0703 start if (isset($data['prices'])) { foreach($data['prices'] as $code=>$pprice) $this->db->query("INSERT INTO " . DB_PREFIX . "product_fixed_prices SET product_id=" . (int)$product_id . ", code = '" . $code . "', products_price = '" . $pprice . "'"); } //sun0703 end $this->cache->delete('product'); ]]></add> </operation> <operation> <search index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ //sun0703 start $query2 = $this->db->query("Select product_discount_id from " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "'"); foreach($query2->rows as $resultc) { $this->db->query("DELETE FROM " . DB_PREFIX . "product_discount_prices WHERE product_discount_id = '" . (int)$resultc['product_discount_id'] . "'"); } $this->db->query("DELETE FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "'"); //sun0703 end //sun0703 start if (isset($data['prices'])) { $this->db->query("DELETE FROM " . DB_PREFIX . "product_fixed_prices WHERE product_id = '" . (int)$product_id . "'"); foreach($data['prices'] as $code=>$pprice){ $query = $this->db->query("select fixed_prices_id from " . DB_PREFIX . "product_fixed_prices WHERE product_id = '" . (int)$product_id . "' and code = '" . $code . "'"); if ($query->num_rows) { $this->db->query("UPDATE " . DB_PREFIX . "product_fixed_prices SET products_price = '" . $pprice . "' WHERE product_id = '" . (int)$product_id . "' and code = '" . $code . "'"); }else{ $this->db->query("INSERT INTO " . DB_PREFIX . "product_fixed_prices SET product_id=" . (int)$product_id . ", code = '" . $code . "', products_price = '" . $pprice . "'"); } } } //sun0703 end ]]></add> </operation> <operation> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ //$this->db->query("DELETE " . DB_PREFIX . "product_special," . DB_PREFIX . "product_special_prices FROM " . DB_PREFIX . "product_special , " . DB_PREFIX . "product_special_prices WHERE product_special.product_id = '" . (int)$product_id . "' and product_special.product_special_id=product_special_prices.product_special_id"); //sun0703 start $query2 = $this->db->query("Select product_special_id from " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "'"); foreach($query2->rows as $resultc) { $this->db->query("DELETE FROM " . DB_PREFIX . "product_special_prices WHERE product_special_id = '" . (int)$resultc['product_special_id'] . "'"); } $this->db->query("DELETE FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "'"); //sun0703 end ]]></add> </operation> <operation> <search><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "product_special SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_special['customer_group_id'] . "', priority = '" . (int)$product_special['priority'] . "', price = '" . (float)$product_special['price'] . "', date_start = '" . $this->db->escape($product_special['date_start']) . "', date_end = '" . $this->db->escape($product_special['date_end']) . "'");]]></search> <add position="replace"><![CDATA[ //sun0703 start //$product_special = $value; $this->db->query("INSERT INTO " . DB_PREFIX . "product_special SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_special['customer_group_id'] . "', priority = '" . (int)$product_special['priority'] . "', price = '" . (float)$product_special['price'] . "', date_start = '" . $this->db->escape($product_special['date_start']) . "', date_end = '" . $this->db->escape($product_special['date_end']) . "'"); if (isset($product_special['prices'])) { $product_special_id = $this->db->getLastId(); //$this->db->query("DELETE FROM " . DB_PREFIX . "product_special_prices WHERE product_special_id = '" . (int)$product_special_id . "'"); foreach($product_special['prices'] as $code=>$pprice) $this->db->query("INSERT INTO " . DB_PREFIX . "product_special_prices SET product_special_id=" . (int)$product_special_id . ", code = '" . $code . "', price = '" . $pprice . "'"); } //sun0703 end ]]></add> </operation> <operation> <search><![CDATA[public function deleteProduct($product_id) {]]></search> <add position="after"><![CDATA[ $this->db->query("DELETE FROM " . DB_PREFIX . "product_fixed_prices WHERE product_id = '" . (int)$product_id . "'"); $query2 = $this->db->query("Select product_option_value_id from " . DB_PREFIX . "product_option_value WHERE product_id = '" . (int)$product_id . "'"); foreach($query2->rows as $resultc) { $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_fixed_prices WHERE product_option_value_id = '" . (int)$resultc['product_option_value_id'] . "'"); } ]]></add> </operation> <operation> <search index="1"><![CDATA[foreach ($product_option['product_option_value'] as $product_option_value) {]]></search> <add position="after"><![CDATA[ //sun0703 start if (isset($product_option_value['prices'])) { foreach($product_option_value['prices'] as $code=>$pprice) $this->db->query("INSERT INTO " . DB_PREFIX . "product_option_fixed_prices SET product_option_value_id=" . (int)$product_option_value['product_option_value_id'] . ", code = '" . $code . "', option_price = '" . $pprice . "'"); } //sun0703 end ]]></add> </operation> <operation> <search><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_option_value WHERE product_id = '" . (int)$product_id . "'");]]></search> <add position="replace"><![CDATA[ //sun0703 start $query2 = $this->db->query("Select product_option_value_id from " . DB_PREFIX . "product_option_value WHERE product_id = '" . (int)$product_id . "'"); foreach($query2->rows as $resultc) { $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_fixed_prices WHERE product_option_value_id = '" . (int)$resultc['product_option_value_id'] . "'"); } $this->db->query("DELETE FROM " . DB_PREFIX . "product_option_value WHERE product_id = '" . (int)$product_id . "'"); //sun0703 end ]]></add> </operation> <operation> <search><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "product_option_value SET product_option_value_id = '" . (int)$product_option_value['product_option_value_id'] . "', product_option_id = '" . (int)$product_option_id . "', product_id = '" . (int)$product_id . "', option_id = '" . (int)$product_option['option_id'] . "', option_value_id = '" . (int)$product_option_value['option_value_id'] . "', quantity = '" . (int)$product_option_value['quantity'] . "', subtract = '" . (int)$product_option_value['subtract'] . "', price = '" . (float)$product_option_value['price'] . "', price_prefix = '" . $this->db->escape($product_option_value['price_prefix']) . "', points = '" . (int)$product_option_value['points'] . "', points_prefix = '" . $this->db->escape($product_option_value['points_prefix']) . "', weight = '" . (float)$product_option_value['weight'] . "', weight_prefix = '" . $this->db->escape($product_option_value['weight_prefix']) . "'");]]></search> <add position="after"><![CDATA[ //sun0703 start $new_product_option_value_id = $this->db->getLastId(); if (isset($product_option_value['prices']) && $new_product_option_value_id>0) { foreach($product_option_value['prices'] as $code=>$pprice){ $this->db->query("INSERT INTO " . DB_PREFIX . "product_option_fixed_prices SET product_option_value_id=" . (int)$new_product_option_value_id . ", code = '" . $code . "', option_price = '" . $pprice . "'"); } } //sun0703 end ]]></add> </operation> <operation> <search ><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "product_discount SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_discount['customer_group_id'] . "', quantity = '" . (int)$product_discount['quantity'] . "', priority = '" . (int)$product_discount['priority'] . "', price = '" . (float)$product_discount['price'] . "', date_start = '" . $this->db->escape($product_discount['date_start']) . "', date_end = '" . $this->db->escape($product_discount['date_end']) . "'");]]></search> <add position="replace"><![CDATA[ //$product_discount = $value; //sun0703 start $this->db->query("INSERT INTO " . DB_PREFIX . "product_discount SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$product_discount['customer_group_id'] . "', quantity = '" . (int)$product_discount['quantity'] . "', priority = '" . (int)$product_discount['priority'] . "', price = '" . (float)$product_discount['price'] . "', date_start = '" . $this->db->escape($product_discount['date_start']) . "', date_end = '" . $this->db->escape($product_discount['date_end']) . "'"); if (isset($product_discount['prices'])) { $product_discount_id = $this->db->getLastId(); //$this->db->query("DELETE FROM " . DB_PREFIX . "product_discount_prices WHERE product_discount_id = '" . (int)$product_discount_id . "'"); foreach($product_discount['prices'] as $code=>$pprice) $this->db->query("INSERT INTO " . DB_PREFIX . "product_discount_prices SET product_discount_id=" . (int)$product_discount_id . ", code = '" . $code . "', price = '" . $pprice . "'"); } //sun0703 end ]]></add> </operation> </file> <file path="admin/controller/catalog/product.php"> <operation> <search><![CDATA[$data['product_specials'][] = array(]]></search> <add position="replace"><![CDATA[ $data['product_specials'][] = array( 'product_special_id' => $product_special['product_special_id'], ]]></add> </operation> <operation> <search><![CDATA[$data['product_discounts'][] = array(]]></search> <add position="replace"><![CDATA[ $data['product_discounts'][] = array( 'product_discount_id' => $product_discount['product_discount_id'], ]]></add> </operation> <operation> <search><![CDATA[$this->response->setOutput($this->load->view('catalog/product_form', $data));]]></search> <add position="before"><![CDATA[ $data['db'] = $this->db; ]]></add> </operation> <operation> <search position="before"><![CDATA[$data['products'][] = array(]]></search> <add position="before"><![CDATA[ if($result['price']<=0){ $query3 = $this->db->query("Select code,products_price from " . DB_PREFIX . "product_fixed_prices where product_id='".$result['product_id']."'"); $tprice = 0; $hasnum=0;$tmpcode=$this->config->get('config_currency');$pc=array(); foreach($query3->rows as $results) { if($results['products_price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['products_price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->config->get('config_currency')."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $result['price'] = sprintf("%.2f",$tprice * ($currcode_value/$productcode_value)) ; } } ]]></add> </operation> <operation> <search position="after"><![CDATA[$special = $product_special['price'];]]></search> <add position="after"><![CDATA[ if($special<=0){ $query3 = $this->db->query("Select code,price from " . DB_PREFIX . "product_special_prices where product_special_id='".$product_special['product_special_id']."'"); $tprice = 0;$hasnum=0;$tmpcode=$this->config->get('config_currency');$pc=array(); foreach($query3->rows as $results) { if($results['price']>0 && !in_array($tmpcode,$pc)){ $tmpcode=$results['code']; $tprice = $results['price']; $hasnum++; if(!in_array($tmpcode,$pc)) $pc[]=$tmpcode; } } if($hasnum==1){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->config->get('config_currency')."'"); foreach ($query4->rows as $result4) { $currcode_value = ($result4['value']); } $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$tmpcode."'"); foreach ($query4->rows as $result4) { $productcode_value = ($result4['value']); } $special = round($tprice * ($currcode_value/$productcode_value),2); } } ]]></add> </operation> </file> <file path="admin/view/template/catalog/product_form.tpl"> <operation> <search><![CDATA[<input type="text" name="price" value="<?php echo $price; ?>" placeholder="<?php echo $entry_price; ?>" id="input-price" class="form-control" />]]></search> <add position="replace"><![CDATA[ <!--sun0703 start--> <?php if(isset($_SESSION['use_fixed_price'])){ $query2 = $db->query("Select * from " . DB_PREFIX . "currency order by value"); if( isset($_GET['product_id'])) $product_id= $_GET['product_id']; if( !isset($_GET['product_id'])) $product_id= ''; foreach($query2->rows as $resultc) { $query3 = $db->query("Select * from " . DB_PREFIX . "product_fixed_prices where code='".$resultc['code']."' and product_id='".$product_id."'"); if($resultc['value']==1) $fixed_price = $price; else $fixed_price = ''; foreach($query3->rows as $results) { $fixed_price = $results['products_price']; } if($resultc['value']==1) echo $resultc['code'].'<input type="text" name="prices['.$resultc['code'].']" value="'.$fixed_price.'" onkeyup="document.getElementById(\'default_price\').value=this.value;" class="form-control" /><br>'; else echo $resultc['code'].'<input type="text" name="prices['.$resultc['code'].']" value="'.$fixed_price.'" class="form-control" /><br>'; } echo '<input type="hidden" name="price" id="default_price" value="'. $price.'" />'; } else echo '<input type="text" name="price" id="default_price" value="'. $price.'" class="form-control" />'; ?> <!--sun0703 end--> ]]></add> </operation> <operation> <search><![CDATA[<input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][price]" value="<?php echo $product_option_value['price']; ?>" placeholder="<?php echo $entry_price; ?>" class="form-control" />]]></search> <add position="replace"><![CDATA[ <?php if(isset($_SESSION['use_fixed_price'])){ $query2 = $db->query("Select * from " . DB_PREFIX . "currency order by value"); foreach($query2->rows as $resultc) { $query3 = $db->query("Select * from " . DB_PREFIX . "product_option_fixed_prices where code='".$resultc['code']."' and product_option_value_id='".$product_option_value['product_option_value_id']."'"); if($resultc['value']==1) $fixed_option_price = $product_option_value['price']; else $fixed_option_price = ''; foreach($query3->rows as $results) { $fixed_option_price = $results['option_price']; } if($resultc['value']==1) echo $resultc['code'].'<input type="text" name="product_option['. $option_row.'][product_option_value]['. $option_value_row.'][prices]['.$resultc['code'].']" value="'.$fixed_option_price.'" onkeyup="document.getElementById(\'default_price_option_'. $option_value_row.'\').value=this.value;" size="5" /><br>'; else echo $resultc['code'].'<input type="text" name="product_option['. $option_row.'][product_option_value]['. $option_value_row.'][prices]['.$resultc['code'].']" value="'.$fixed_option_price.'" size="5" /><br>'; } echo '<input type="hidden" name="product_option['. $option_row.'][product_option_value]['. $option_value_row.'][price]" id="default_price_option_'. $option_value_row.'" value="'. $product_option_value['price'].'" />'; } else{ ?> <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][price]" value="<?php echo $product_option_value['price']; ?>" placeholder="<?php echo $entry_price; ?>" class="form-control" /> <?php } ?> ]]></add> </operation> <operation> <search><![CDATA[html += ' <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price]" value="" placeholder="<?php echo $entry_price; ?>" class="form-control" /></td>';]]></search> <add position="replace"><![CDATA[ <?php if(isset($_SESSION['use_fixed_price'])){ echo 'html += \' \';'; $query2 = $db->query("Select * from " . DB_PREFIX . "currency order by value"); foreach($query2->rows as $resultc) { if($resultc['value']==1) echo ' html +=\''.$resultc['code'].'<input type="text" name="product_option[\' + option_row + \'][product_option_value][\' + option_value_row + \'][prices]['.$resultc['code'].']" value="" onkeyup="document.getElementById(\\\'default_option_price\' + option_row +option_value_row+ \'\\\').value=this.value;" class="form-control" /><br>\';'; else echo ' html +=\''.$resultc['code'].'<input type="text" name="product_option[\' + option_row + \'][product_option_value][\' + option_value_row + \'][prices]['.$resultc['code'].']" value="" class="form-control" /><br>\';'; } echo ' html +=\''.'<input type="hidden" name="product_option[\' + option_row + \'][product_option_value][\' + option_value_row + \'][price]" value="" id="default_option_price\' + option_row +option_value_row + \'" /><br>\';'; echo 'html += \'</td>\';'; } else{ ?> html += ' <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price]" value="" placeholder="<?php echo $entry_price; ?>" class="form-control" /></td>'; <?php } ?> ]]></add> </operation> </file> <file path="admin/model/report/sale.php"> <operation> <search><![CDATA[public function getTotalSales($data = array()) {]]></search> <add position="after"><![CDATA[ if(isset($_SESSION['use_fixed_price'])){ $tmptotal = 0; $query2 = $this->db->query("SELECT total,currency_code FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0'"); foreach($query2->rows as $resultc) { $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$resultc['currency_code']."'"); foreach ($query4->rows as $result4) { $resultc['total'] /= ($result4['value']); } $tmptotal+= $resultc['total']; } return $tmptotal; } ]]></add> </operation> <operation> <search><![CDATA[$sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, COUNT(*) AS `orders`, SUM((SELECT SUM(op.quantity) FROM `" . DB_PREFIX . "order_product` op WHERE op.order_id = o.order_id GROUP BY op.order_id)) AS products, SUM((SELECT SUM(ot.value) FROM `" . DB_PREFIX . "order_total` ot WHERE ot.order_id = o.order_id AND ot.code = 'tax' GROUP BY ot.order_id)) AS tax, SUM(o.total) AS `total` FROM `" . DB_PREFIX . "order` o";]]></search> <add position="replace"><![CDATA[$sql = "SELECT group_concat(o.order_id) as orders_id,MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, COUNT(*) AS `orders`, SUM((SELECT SUM(op.quantity) FROM `" . DB_PREFIX . "order_product` op WHERE op.order_id = o.order_id GROUP BY op.order_id)) AS products, SUM((SELECT SUM(ot.value) FROM `" . DB_PREFIX . "order_total` ot WHERE ot.order_id = o.order_id AND ot.code = 'tax' GROUP BY ot.order_id)) AS tax, SUM(o.total) AS `total` FROM `" . DB_PREFIX . "order` o";]]></add> </operation> <operation> <search index="1"><![CDATA[$query = $this->db->query($sql);]]></search> <add index="0,1" position="after"><![CDATA[ if(isset($_SESSION['use_fixed_price'])){ foreach($query->rows as $k=>$row){ $tmptotal = 0; $sql2="SELECT total,currency_code FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND order_id in (".$row['orders_id'].")"; $query2 = $this->db->query($sql2); foreach($query2->rows as $resultc) { $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$resultc['currency_code']."'"); foreach ($query4->rows as $result4) { $resultc['total'] /= ($result4['value']); } $tmptotal+= $resultc['total']; } $query->rows[$k]['total']=$tmptotal; } } ]]></add> </operation> <operation> <search><![CDATA[$query = $this->db->query("SELECT COUNT(*) AS total, SUM(o.total) AS amount, c.iso_code_2 FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "country` c ON (o.payment_country_id = c.country_id) WHERE o.order_status_id > '0' GROUP BY o.payment_country_id");]]></search> <add position="replace"><![CDATA[$query = $this->db->query("SELECT group_concat(o.order_id) as orders_id,COUNT(*) AS total, SUM(o.total) AS amount, c.iso_code_2 FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "country` c ON (o.payment_country_id = c.country_id) WHERE o.order_status_id > '0' GROUP BY o.payment_country_id");]]></add> </operation> <operation> <search index="0" ><![CDATA[return $query->rows;]]></search> <add index="0" position="replace"><![CDATA[ if(isset($_SESSION['use_fixed_price'])){ foreach($query->rows as $k=>$row){ $tmptotal = 0; $sql2="SELECT total,currency_code FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND order_id in (".$row['orders_id'].")"; $query2 = $this->db->query($sql2); foreach($query2->rows as $resultc) { $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$resultc['currency_code']."'"); foreach ($query4->rows as $result4) { $resultc['total'] /= ($result4['value']); } $tmptotal+= $resultc['total']; } $query->rows[$k]['amount']=$tmptotal; } } return $query->rows; ]]></add> </operation> </file> <file path="catalog/controller/total/shipping.php"> <operation error="skip"> <search><![CDATA[if ($quote) {]]></search> <add position="after"><![CDATA[ if(isset($_SESSION['use_fixed_price'])){ foreach($quote['quote'] as $k=>$newquote){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $quote['quote'][$k]['cost']*= ($result4['value']); } $quote['quote'][$k]['text']= $this->currency->format($this->tax->calculate($quote['quote'][$k]['cost'], $quote['quote'][$k]['tax_class_id'], $this->config->get('config_tax'))); } } ]]></add> </operation> </file> <file path="catalog/controller/checkout/shipping_method.php"> <operation error="skip"> <search><![CDATA[if ($quote) {]]></search> <add position="after"><![CDATA[ if(isset($_SESSION['use_fixed_price'])){ foreach($quote['quote'] as $k=>$newquote){ $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$this->session->data['currency']."'"); foreach ($query4->rows as $result4) { $quote['quote'][$k]['cost']*= ($result4['value']); } $quote['quote'][$k]['text']= $this->currency->format($this->tax->calculate($quote['quote'][$k]['cost'], $quote['quote'][$k]['tax_class_id'], $this->config->get('config_tax')),$this->session->data['currency']); } } ]]></add> </operation> </file> <file path="admin/model/report/product.php"> <operation> <search><![CDATA[public function getPurchased($data = array()) {]]></search> <add position="after"><![CDATA[ if(isset($_SESSION['use_fixed_price'])){ $sql = "SELECT op.product_id , op.name, op.model, SUM(op.quantity) AS quantity, SUM((op.total + op.tax) * op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id)"; if (!empty($data['filter_order_status_id'])) { $sql .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'"; } else { $sql .= " WHERE o.order_status_id > '0'"; } if (!empty($data['filter_date_start'])) { $sql .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'"; } if (!empty($data['filter_date_end'])) { $sql .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'"; } $sql .= " GROUP BY op.product_id ORDER BY total DESC"; if (isset($data['start']) || isset($data['limit'])) { if ($data['start'] < 0) { $data['start'] = 0; } if ($data['limit'] < 1) { $data['limit'] = 20; } $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit']; } $query = $this->db->query($sql); foreach($query->rows as $key=> $resultc) { $tmptotal=0; $sql2 = "SELECT op.product_id ,o.currency_code, op.name, op.model, op.quantity AS quantity, (op.total + op.tax) AS proprice FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) and op.product_id='".$resultc['product_id']."'"; if (!empty($data['filter_order_status_id'])) { $sql2 .= " WHERE o.order_status_id = '" . (int)$data['filter_order_status_id'] . "'"; } else { $sql2 .= " WHERE o.order_status_id > '0'"; } if (!empty($data['filter_date_start'])) { $sql2 .= " AND DATE(o.date_added) >= '" . $this->db->escape($data['filter_date_start']) . "'"; } if (!empty($data['filter_date_end'])) { $sql2 .= " AND DATE(o.date_added) <= '" . $this->db->escape($data['filter_date_end']) . "'"; } $query2 = $this->db->query($sql2); foreach($query2->rows as $resultc2) { $query4 = $this->db->query("SELECT value FROM " . DB_PREFIX . "currency where code='".$resultc2['currency_code']."'"); foreach ($query4->rows as $result4) { $resultc2['proprice'] /= ($result4['value']); } $tmptotal+= $resultc2['proprice']*$resultc2['quantity']; } $query->rows[$key]['total']= $tmptotal; } return $query->rows; } ]]></add> </operation> </file> </modification>