Post by ckschew » Sat Mar 03, 2012 2:30 am

it's very simply. you just need to add in a very short line. let's say the table name that you are using is abc, then your code will be like the following:-

$query = $this->db->query("SELECT DISTINCT *, p.abc, pd.name AS name, p.image, m.name AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$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) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$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) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$customer_group_id . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");

Newbie

Posts

Joined
Fri Mar 02, 2012 11:25 pm

Post by TrinaLuna » Sun Mar 04, 2012 11:42 am

Hello! If someone could help an amateur along with this, I would greatly appreciate it :). I am attempting to use this mod with vQmod (I'm using the vQmod XML File Generator).

Two errors I'm stuck at. When visiting the main page of my store, I encounter this error:
Parse error: syntax error, unexpected ',' in /home/littlep/public_html/autos/vqmod/vqcache/vq2-catalog_model_catalog_product.php on line 15
When visiting the Products tab in the Admin, I encounter this error:
Parse error: syntax error, unexpected '=' in /home/littlep/public_html/autos/vqmod/vqcache/vq2-admin_model_catalog_product.php on line 5
This is my xml file:

Code: Select all

<!-- Created using vQmod XML Generator by UKSB - http://www.opencart-extensions.co.uk //-->
<modification>
	<id><![CDATA[Car Data Fields]]></id>
	<version><![CDATA[1]]></version>
	<vqmver><![CDATA[1]]></vqmver>
	<author><![CDATA[TrinaLuna]]></author>
	<file name="admin/controller/catalog/product.php">
		<operation>
			<search position="before"><![CDATA[if (isset($this->request->get['filter_name']))]]></search>
			<add><![CDATA[if (isset($this->request->post['VIN'])) {
            $this->data['VIN'] = $this->request->post['VIN'];
       } elseif (isset($product_info)) {
         $this->data['VIN'] = $product_info['VIN'];
      } else {
            $this->data['VIN'] = '';
       }
if (isset($this->request->post['Bodystyle'])) {
            $this->data['Bodystyle'] = $this->request->post['Bodystyle'];
       } elseif (isset($product_info)) {
         $this->data['Bodystyle'] = $product_info['Bodystyle'];
      } else {
            $this->data['Bodystyle'] = '';
       }
if (isset($this->request->post['Color'])) {
            $this->data['Color'] = $this->request->post['Color'];
       } elseif (isset($product_info)) {
         $this->data['Color'] = $product_info['Color'];
      } else {
            $this->data['Color'] = '';
       }
if (isset($this->request->post['Interior Color'])) {
            $this->data['Interior Color'] = $this->request->post['Interior Color'];
       } elseif (isset($product_info)) {
         $this->data['Interior Color'] = $product_info['Interior Color'];
      } else {
            $this->data['Interior Color'] = '';
       }
if (isset($this->request->post['Mileage'])) {
            $this->data['Mileage'] = $this->request->post['Mileage'];
       } elseif (isset($product_info)) {
         $this->data['Mileage'] = $product_info['Mileage'];
      } else {
            $this->data['Mileage'] = '';
       }
if (isset($this->request->post['Transmission'])) {
            $this->data['Transmission'] = $this->request->post['Transmission'];
       } elseif (isset($product_info)) {
         $this->data['Transmission'] = $product_info['Transmission'];
      } else {
            $this->data['Transmission'] = '';
       }
if (isset($this->request->post['Engine'])) {
            $this->data['Engine'] = $this->request->post['Engine'];
       } elseif (isset($product_info)) {
         $this->data['Engine'] = $product_info['Engine'];
      } else {
            $this->data['Engine'] = '';
       }
if (isset($this->request->post['Drivetrain'])) {
            $this->data['Drivetrain'] = $this->request->post['Drivetrain'];
       } elseif (isset($product_info)) {
         $this->data['Drivetrain'] = $product_info['Drivetrain'];
      } else {
            $this->data['Drivetrain'] = '';
       }
if (isset($this->request->post['Fuel Type'])) {
            $this->data['Fuel Type'] = $this->request->post['Fuel Type'];
       } elseif (isset($product_info)) {
         $this->data['Fuel Type'] = $product_info['Fuel Type'];
      } else {
            $this->data['Fuel Type'] = '';
       }
if (isset($this->request->post['Seats'])) {
            $this->data['Seats'] = $this->request->post['Seats'];
       } elseif (isset($product_info)) {
         $this->data['Seats'] = $product_info['Seats'];
      } else {
            $this->data['Seats'] = '';
       }
]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[$this->data['heading_title'] = $this->language->get('heading_title');]]></search>
			<add><![CDATA[$this->data['entry_VIN'] = $this->language->get('entry_VIN');
$this->data['entry_Bodystyle'] = $this->language->get('entry_Bodystyle');
$this->data['entry_Color'] = $this->language->get('entry_Color');
$this->data['entry_Interior Color'] = $this->language->get('entry_Interior Color');
$this->data['entry_Mileage'] = $this->language->get('entry_Mileage');
$this->data['entry_Transmission'] = $this->language->get('entry_Transmission');
$this->data['entry_Engine'] = $this->language->get('entry_Engine');
$this->data['entry_Drivetrain'] = $this->language->get('entry_Drivetrain');
$this->data['entry_Fuel Type'] = $this->language->get('entry_Fuel Type');
$this->data['entry_Seats'] = $this->language->get('entry_Seats');]]></add>
		</operation>
	</file>
	<file name="admin/view/template/catalog/product_form.tpl">
		<operation>
			<search position="after"><![CDATA[<div id="tab-data">]]></search>
			<add><![CDATA[     <tr>
              <td><?php echo $entry_VIN; ?></td>
              <td><input type="text" name="VIN" value="<?php echo $VIN; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Bodystyle; ?></td>
              <td><input type="text" name="Bodystyle" value="<?php echo $Bodystyle; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Color; ?></td>
              <td><input type="text" name="Color" value="<?php echo $Color; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Interior Color; ?></td>
              <td><input type="text" name="Interior Color" value="<?php echo $Interior Color; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Mileage; ?></td>
              <td><input type="text" name="Mileage" value="<?php echo $Mileage; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Transmission; ?></td>
              <td><input type="text" name="Transmission" value="<?php echo $Transmission; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Engine; ?></td>
              <td><input type="text" name="Engine" value="<?php echo $Engine; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Drivetrain; ?></td>
              <td><input type="text" name="Drivetrain" value="<?php echo $Drivetrain; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Fuel Type; ?></td>
              <td><input type="text" name="Fuel Type" value="<?php echo $Fuel Type; ?>" /></td>
              </td>
            </tr>
     <tr>
              <td><?php echo $entry_Seats; ?></td>
              <td><input type="text" name="Seats" value="<?php echo $Seats; ?>" /></td>
              </td>
            </tr>]]></add>
		</operation>
	</file>
	<file name="admin/language/english/catalog/product.php">
		<operation>
			<search position="after"><![CDATA[$_['entry_upc']              = 'UPC:';]]></search>
			<add><![CDATA[$_['entry_VIN']              = 'VIN:';
$_['entry_Bodystyle']              = 'Bodystyle:';
$_['entry_Color']              = 'Color:';
$_['entry_Interior Color']              = 'Interior Color:';
$_['entry_Mileage']              = 'Mileage:';
$_['entry_Transmission']              = 'Transmission:';
$_['entry_Engine']              = 'Engine:';
$_['entry_Drivetrain']              = 'Drivetrain:';
$_['entry_Fuel Type']              = 'Fuel Type:';
$_['entry_Seats']              = 'Seats:';]]></add>
		</operation>
	</file>
	<file name="admin/model/catalog/product.php">
		<operation>
			<search position="after"><![CDATA[		$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "',]]></search>
			<add><![CDATA[ VIN = '" . $this->db->escape($data['VIN']) . "', Bodystyle = '" . $this->db->escape($data['Bodystyle']) . "', Color = '" . $this->db->escape($data['Color']) . "', Interior Color = '" . $this->db->escape($data['Interior Color']) . "', Mileage = '" . $this->db->escape($data['Mileage']) . "', Transmission = '" . $this->db->escape($data['Transmission']) . "', Engine = '" . $this->db->escape($data['Engine']) . "', Drivetrain = '" . $this->db->escape($data['Drivetrain']) . "', Fuel Type = '" . $this->db->escape($data['Fuel Type']) . "', Seats = '" . $this->db->escape($data['Seats']) . "',]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[		$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "',]]></search>
			<add><![CDATA[ VIN = '" . $this->db->escape($data['VIN']) . "', Bodystyle = '" . $this->db->escape($data['Bodystyle']) . "', Color = '" . $this->db->escape($data['Color']) . "', Interior Color = '" . $this->db->escape($data['Interior Color']) . "', Mileage = '" . $this->db->escape($data['Mileage']) . "', Transmission = '" . $this->db->escape($data['Transmission']) . "', Engine = '" . $this->db->escape($data['Engine']) . "', Drivetrain = '" . $this->db->escape($data['Drivetrain']) . "', Fuel Type = '" . $this->db->escape($data['Fuel Type']) . "', Seats = '" . $this->db->escape($data['Seats']) . "',]]></add>
		</operation>
	</file>
	<file name="catalog/controller/product/product.php">
		<operation>
			<search position="before"><![CDATA[			$this->document->setTitle($product_info['name']);]]></search>
			<add><![CDATA[$this->data['entry_VIN'] = $this->language->get('entry_VIN');
$this->data['entry_Bodystyle'] = $this->language->get('entry_Bodystyle');
$this->data['entry_Color'] = $this->language->get('entry_Color');
$this->data['entry_Interior Color'] = $this->language->get('entry_Interior Color');
$this->data['entry_Mileage'] = $this->language->get('entry_Mileage');
$this->data['entry_Transmission'] = $this->language->get('entry_Transmission');
$this->data['entry_Engine'] = $this->language->get('entry_Engine');
$this->data['entry_Drivetrain'] = $this->language->get('entry_Drivetrain');
$this->data['entry_Fuel Type'] = $this->language->get('entry_Fuel Type');
$this->data['entry_Seats'] = $this->language->get('entry_Seats');]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[			$this->data['heading_title'] = $product_info['name'];]]></search>
			<add><![CDATA[$this->data['VIN'] = $product_info['VIN'];
$this->data['Bodystyle'] = $product_info['Bodystyle'];
$this->data['Color'] = $product_info['Color'];
$this->data['Interior Color'] = $product_info['Interior Color'];
$this->data['Mileage'] = $product_info['Mileage'];
$this->data['Transmission'] = $product_info['Transmission'];
$this->data['Engine'] = $product_info['Engine'];
$this->data['Drivetrain'] = $product_info['Drivetrain'];
$this->data['Fuel Type'] = $product_info['Fuel Type'];
$this->data['Seats'] = $product_info['Seats'];]]></add>
		</operation>
	</file>
	<file name="catalog/model/catalog/product.php">
		<operation>
			<search position="after"><![CDATA[		$query = $this->db->query("SELECT DISTINCT *,]]></search>
			<add><![CDATA[p.VIN, p.Bodystyle, p.Color, p.Interior Color, p.Mileage, p.Transmission, p.Engine, p.Drivetrain, p.Fuel Type, p.Seats,]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[			$query->row['rating'] = (int)$query->row['rating'];]]></search>
			<add><![CDATA['VIN'       => $query->row['VIN'],
'Bodystyle'       => $query->row['Bodystyle'],
'Color'       => $query->row['Color'],
'Interior Color'       => $query->row['Interior Color'],
'Mileage'       => $query->row['Mileage'],
'Transmission'       => $query->row['Transmission'],
'Engine'       => $query->row['Engine'],
'Drivetrain'       => $query->row['Drivetrain'],
'Fuel Type'       => $query->row['Fuel Type'],
'Seats'       => $query->row['Seats'],]]></add>
		</operation>
	</file>
</modification>
I have a feeling these are just silly mistakes that are staring me in the face, if I'm in over my head please tell me so! :-\

I am using the latest version of OpenCart and vQmod on a fresh install.

Newbie

Posts

Joined
Sun Mar 04, 2012 11:36 am

Post by ChipH » Sun Apr 08, 2012 1:54 am

I'm doing all of this by hand and not using vQmod, but I'm having 2 issues.

1. Like ann23262, catalog/model/catalog/product.php doesn't match. I'm working on 1.5.2.1 which is probably why. The weird thing though is that I have all of my custom fields showing up fine on the product page WITHOUT this code being there. I checked the product.php file from 1.5.1 and it looks like the big array of fields is no longer in 1.5.2.1.

2. Possbily related to #1, I'm trying to get the custom fields to work on the catalog page, not just the products page. I had it working on 1.4.6 when I originally did it a couple of years ago but can't seem to figure it out on the new version. I'm assuming that the change in catalog/model/catalog/product.php is what's keeping me from getting the variables to work on the catalog page, but doesn't explain how it's still working on the products page.

Any hints would be appreciated!

Newbie

Posts

Joined
Sun Apr 08, 2012 1:15 am

Post by MrTech » Sun Apr 08, 2012 4:33 am

ChipH wrote:I'm doing all of this by hand and not using vQmod...
You should really look into using vqmod as it also requires things to be done "by hand". What you are actually doing is manually changing the core files which *will* break when you upgrade to the next version. With vqmod, you can just turn off any changes you make if they get broken. You should give it a go, the learning curve is very minor, especially when you start to download free vqmods and edit the files to find out how simple it all is.

Q1, find the section in the file that is similar and add your table in there as was posted a couple posts above.
Q2, the changes that were made in product.php will also need to be done to category.php in the same folder. The same would apply if you wanted to add this to the manufacturer pages.

Hope this helps and don't forget to share your code when you are done so others can learn by studying your hard work.

~
Install Extensions OR OpenCart Fast Service! PayPal Accepted
I will professionally install and configure any free or purchased theme, module or extension.

Visit http://www.mrtech.ca if you need an OpenCart webmaster
~


User avatar
Active Member

Posts

Joined
Mon Jan 09, 2012 2:39 pm
Location - Canada, Eh!

Post by ChipH » Tue Apr 10, 2012 1:31 am

Well, got it working. Still without the code changes to catalog/model/catalog/product.php though, but... whatever!

I found the code to get the variables to show up in the catalog/controller/product/category.php. There's an array around line 187 they need to be added to. I was barking up the wrong tree with the model files.

I'll take a look at vqmod. I'm updating an old store I had done a couple years ago on 1.4.6 and was just trying to go about it the same way as last time. I can post my xml file with the stuff done for the categories when I'm done if anyone wants it. It looks like the other ones floating around have some things that aren't necessary with 1.5.2.1.

Newbie

Posts

Joined
Sun Apr 08, 2012 1:15 am

Post by vivekdbit » Tue May 01, 2012 11:02 pm

Hello, I am adding custom field. I have created VQmod XML file for it. everything is working fine add, update and delete but for following tpl file it is not working.
To make this tpl work, i have directly edited the product_form.tpl and its working.

But i want everything changes i made for custom adding field in one xml.

Code: Select all

<file name="admin/view/template/catalog/product_form.tpl">
        <operation>
            <search position="after"><![CDATA[<tr>
              <td><span class="required">*</span> <?php echo $entry_model; ?></td>
              <td><input type="text" name="model" value="<?php echo $model; ?>" />
                <?php if ($error_model) { ?>
                <span class="error"><?php echo $error_model; ?></span>
                <?php } ?></td>
            </tr>
            ]]></search>
            <add><![CDATA[
            <tr>
              <td><?php echo $entry_range; ?></td>
             <td><input type="text" name="small_box" value="<?php echo $small; ?>" size="4" /></td>
              </td>
            </tr>
            ]]></add>
        </operation>
	</file>
I got confuse. Please help me to sort out the problem?
Thanks in advance.

Newbie

Posts

Joined
Wed Apr 11, 2012 10:26 pm

Post by MrTech » Tue May 01, 2012 11:23 pm

With VQMod, you can't search for blocks of text like you are trying to do. You can only find 1 line but then can use the 'offset' function to get the rest of the text. You might even have to use the 'index' function as well if there are many lines with the same code.

Everything you need to know can be found on this page:
http://code.google.com/p/vqmod/wiki/Scripting

~
Install Extensions OR OpenCart Fast Service! PayPal Accepted
I will professionally install and configure any free or purchased theme, module or extension.

Visit http://www.mrtech.ca if you need an OpenCart webmaster
~


User avatar
Active Member

Posts

Joined
Mon Jan 09, 2012 2:39 pm
Location - Canada, Eh!

Post by vivekdbit » Wed May 02, 2012 1:09 pm

Thnx MrTech,

I used 'offset' function and it works fine.

Newbie

Posts

Joined
Wed Apr 11, 2012 10:26 pm

Post by Klimskady » Sun May 06, 2012 4:48 am

vivekdbit wrote:Thnx MrTech,

I used 'offset' function and it works fine.
Would you be able to post the vQmod file that you got to work?

I am trying to add a size field as I am offering specific size gemstones and need all the help I can get!

Active Member

Posts

Joined
Tue Jun 07, 2011 7:57 am

Post by thegeekz » Thu May 10, 2012 12:48 pm

Hmm this is an interesting find...

I need to have a Price Including Tax/GST in the Product page.

I already have used uksitebuilder way to include that -- with computations etc... but in order for this field to be included in the Export Import Tool or Qphoria's JQListEdit as a field in the product list-- may have to add in a custom field (linked to the database)?

Can an expert enlighten me if this is possible?

As I require the Export Import Tool / JQListEdit to have the Price Inc. GST/Tax field for my client to add/edit.

Here's his vqmod xml:

Code: Select all

<modification>
	<id>SG Inc and Exc GST Price Boxes</id>
	<version>1.0</version>
	<vqmver>1.2.3</vqmver>
	<author>http://www.opencart-extensions.co.uk/</author>
	<file name="admin/view/template/catalog/product_form.tpl">
		<operation>
			<search position="replace"><![CDATA[<input type="text" name="price" value="<?php echo $price; ?>" />]]></search>
			<add><![CDATA[exc. GST -> <input type="text" class="exgst" name="price" value="<?php echo $price; ?>" /> inc. GST -> <input type="text" name="incgst" class="incgst" value="<?php echo number_format(($price*1.07),2,'.',''); ?>" />]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[<?php echo $footer; ?>]]></search>
			<add><![CDATA[<script type="text/javascript"><!--
$('.incgst').bind('change keydown keyup',function (){
   $('input.exgst').val(($(this).val()/1.07).toFixed(4));
});
$('.exgst').bind('change keydown keyup',function (){
   $('input.incgst').val(($(this).val()*1.07).toFixed(2));
});
//--></script>]]></add>
		</operation>
	</file>
</modification>


Client requires that the Price incl. Tax be displayed for each product and upon checkout as well.

Thanks...

No more using Apsona, as they are not updated.

  • Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC


Active Member

Posts

Joined
Tue Nov 02, 2010 10:24 am

Post by MrTech » Thu May 10, 2012 1:18 pm

Klimskady wrote:I am trying to add a size field
Someone has already done the work for you. The name isn't very intuitive but should resolve your problem.

Hope that helps...

~
Install Extensions OR OpenCart Fast Service! PayPal Accepted
I will professionally install and configure any free or purchased theme, module or extension.

Visit http://www.mrtech.ca if you need an OpenCart webmaster
~


User avatar
Active Member

Posts

Joined
Mon Jan 09, 2012 2:39 pm
Location - Canada, Eh!

Post by papteam » Tue Jul 17, 2012 9:07 pm

Can someone help me?

Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
Error No: 1064
SELECT COUNT(DISTINCT p.product_id) AS total FROM oil_product p LEFT JOIN oil_product_description pd ON (p.product_id = pd.product_id) LEFT JOIN oil_product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '2' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '0' AND p.product_id IN (SELECT p2c.product_id FROM oil_product_to_category p2c WHERE ) in /home/qualityoil/domains/qualityoils.nl/public_html/system/database/mysql.php on line 49

New member

Posts

Joined
Tue Feb 07, 2012 6:30 pm

Post by dax87 » Mon Sep 10, 2012 5:53 am

hello guys,
I need help.

The instalation of contrib was successful and everything works perfectly.

I just have one question.

I have created several tabs, the problem is that the titles of the tab I appear in the products even if the entry is zero.

example:

Product: iMac
Brand: Apple
Code: 4554
Operating System:

Here is the operating system I would not see that in the product because the entry is blank.

Newbie

Posts

Joined
Mon Sep 10, 2012 5:39 am

Post by dax87 » Mon Sep 10, 2012 8:41 pm

Here's an example:
The screen appears correctly.
Image

everything is correct. But I wish that the "Parti Staccate" does not appear on the product page in admin if the text and "0" ..

Newbie

Posts

Joined
Mon Sep 10, 2012 5:39 am

Post by AdamV2 » Tue Oct 02, 2012 6:12 pm

It a great tutorial. Thank you to all of the contributors in the thread!

Base on the instruction provided I was able to successfully add couple of product fields I needed for the shop I am working on. However I got confused when trying to use a new column in product table containing index to an additional custom table created to work in conjuction.

Here's the situation:
In the 'products' table I have added 'format' field. It is supposed to store 'format_id' value from 'format' table
I have also added 'format' table contaning fields 'format_id', 'name', 'icon'
I am successfull till the Step 3 of the tutorial, then I got confused about the product_form.tpl lines I need to use in order to have a drop down select field.

Based on the step 3 I ended up with the following peiece of code:

Code: Select all

<tr>
              <td><?php echo $entry_format; ?></td>
              <td><select name="format">
                  <?php foreach ($formats as $format) { ?> // This is just looping over an array I built in the previouse page (step 2) and now loops here
                  <?php if ($format['format_id'] == $format) { ?>
                  <option value="<?php echo $format['format_id']; ?>" selected="selected"><?php echo $format['name']; ?></option>
                  <?php } else { ?>
                  <option value="<?php echo $format['format_id']; ?>"><?php echo $format['name']; ?></option>
                  <?php } ?>
                  <?php } ?>
                </select></td>
            </tr>
but that gives me en empty dropdown in product form. I am not sure how it is supposed to get the info from my 'format' table and how should product_form.tpl successfully access it.

Any clues?

Newbie

Posts

Joined
Tue Oct 02, 2012 5:55 pm

Post by godel » Fri Nov 23, 2012 6:44 pm

Hello Heizo,

Thanks and It's great tutorial.

Please help me,
I have followed all the instructions you give, and work well. However, when editing the product again, the data does not appear in custom field, but in phpmyadmin table, the data is available and stored there.

So if i edit product again then I have to re-enter custom field data.

I'm using OC 1.5.4.1

Here is my code in Edit Product (jml_dvd)

Code: Select all

public function editProduct($product_id, $data) {
$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', jml_dvd = '" . $this->db->escape($data['jml_dvd']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");

Newbie

Posts

Joined
Fri Nov 23, 2012 6:30 pm

Post by siberso » Tue Jan 01, 2013 9:41 pm

hello ,
I ve 1.5 2,1 , I ve use vqmod for installing this extension, but ı am getting the following error on page

text_size Notice: Undefined variable: size in /home/../domains/izmireticaret.com/public_html/shop/vqmod/vqcache/vq2-catalog_view_theme_default_template_product_product.tpl on line 31

is there a one can helpme please=?

Newbie

Posts

Joined
Tue Jan 01, 2013 9:37 pm

Post by charithlahiru » Mon Feb 11, 2013 1:05 am

how do i change first name to surename in a field lable

Newbie

Posts

Joined
Mon Feb 11, 2013 12:21 am

Post by alternatywy2 » Wed Jun 05, 2013 6:23 am

Hi, nice solution it might be when I get through the following issue:

I need just one custom field, hence I created one new field called 'myfield' in the products table. Located in the product/data, the field has to be a dropdown select menu with three options in it (i.e. apple, orange, banana), so I'm using the code from step 3 of heizo's tutorial. I've changed all 'Table Name' occurences to 'myfield' (the 'Table Name_id' tp 'myfield_id') and completed the rest of the coding for the admin side.

The problem is that upon going to product/data all I get is just an empty dropdown menu, no options in it. It seems to make sense though, 'cause I don't see anywhere in heizo's admin-side instructions where the desired three options would be added.

If I understood well, ONE custom field = ONE new field added to the product table. However, where do I add the THREE dropdown menu options, the system needs to pull them out from somewhere?

One more thing: I need to make that field 'required', so probably would need some error message in case when, upon adding a new product, the user forgets to choose one of the three options.

Appreciate some ideas.

New member

Posts

Joined
Wed Jun 05, 2013 5:42 am

Post by crazykiddo » Sat Jul 20, 2013 1:14 pm

All you guys with zero at the end means your sql is messed up. LOL ;D
I got it to work but it's repeating itself.

I did this before I even saw this forum... Would've saved a lot of time seeing this before hand.

So far I have
Color: red red
Size: 16'' 16''

You guys can also do the tpl which gives you an output but it's only for one option one color or one whatever

It likes to repeat itself; seems like it's echoing twice. Is there a fix to this? If so which folder would it be in. I hate digging around the codes if only I saw this forum earlier... :/

Any help would be nice!

Newbie

Posts

Joined
Sat Jun 22, 2013 10:32 am
Who is online

Users browsing this forum: No registered users and 6 guests