Post by sans » Fri Dec 10, 2010 2:21 pm

I am using oc 1.4.9. How to add extra field such as color and size (as number) under model on menu administration -> catalog -> products -> data ?
product.jpg

product.jpg (35.68 KiB) Viewed 9683 times

Thanks

kaos jersey, jersey bola, baju bola, baju bola terbaru, baju bola murah


Active Member

Posts

Joined
Tue Dec 07, 2010 9:18 am

Post by Xsecrets » Fri Dec 10, 2010 9:38 pm

It's not easy and takes some coding knowledge. There is the Product Extra Fields module which adds a new tab with admin definable fields. It modifies lots of core files because it pretty much has to. This functionality will be built into 1.5.0, but currently you either have to go with the Product Extra Fields mod or get your hands dirty coding.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by sans » Sat Jan 01, 2011 10:36 am

Why did not answer my question, instead you offer a product? I think as a programmer like you would be very easy to add extra fields.

kaos jersey, jersey bola, baju bola, baju bola terbaru, baju bola murah


Active Member

Posts

Joined
Tue Dec 07, 2010 9:18 am

Post by Xsecrets » Sat Jan 01, 2011 11:21 am

well then go ahead and do it. as I said it's not easy, and I'm not going to spend an hour typing out all the stuff that I spent a week figuring out sorry.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by nosecret » Tue Jan 04, 2011 4:28 pm

Hi sans, this is modification to you as what you want. I hope you enjoy with this modification and still use opencart.

Last edited by nosecret on Thu Sep 29, 2011 9:32 pm, edited 3 times in total.

Active Member

Posts

Joined
Tue Dec 28, 2010 12:28 pm

Post by sans » Sat Jan 15, 2011 6:03 pm

Hi nosecret,
Thanks for your modification. Well done, well done!!

kaos jersey, jersey bola, baju bola, baju bola terbaru, baju bola murah


Active Member

Posts

Joined
Tue Dec 07, 2010 9:18 am

Post by tkidess » Fri Mar 04, 2011 7:58 pm

Hi sans and nosecret, can either of you send me that modification that you mentioned? thanks,

Newbie

Posts

Joined
Fri Mar 04, 2011 7:35 pm

Post by sans » Sun Mar 20, 2011 12:10 am

Hi tkidess,

This is modification to you as your request. I hope you enjoy and sorry to wait long time.
Last edited by sans on Wed Sep 28, 2011 9:50 pm, edited 1 time in total.

kaos jersey, jersey bola, baju bola, baju bola terbaru, baju bola murah


Active Member

Posts

Joined
Tue Dec 07, 2010 9:18 am

Post by daledude » Thu Apr 14, 2011 11:53 pm

Thanks for this awesome mod! Works perfectly. Allowed me to do exactly what I wanted in this thread for #2: http://forum.opencart.com/viewtopic.php ... 90#p146390

New member

Posts

Joined
Thu Dec 17, 2009 1:30 am

Post by daledude » Fri Apr 15, 2011 12:03 am

Hm, except that you can't use the import function with the new fields. It says
Uploaded file is not a valid spreadsheet file or its values are not in the expected formats!
... whenever I try to import the updated spreadsheet with the new fields entered. I guess something else needs to be edited for that to work?

New member

Posts

Joined
Thu Dec 17, 2009 1:30 am

Post by daledude » Fri Apr 15, 2011 4:51 am

I've figured out how to EXPORT the extra fields thanks to this lovely post: http://forum.opencart.com/viewtopic.php ... 40#p123040

But whenever I IMPORT the Excel file, it gives this error:

Code: Select all

Notice: Undefined offset: 13 in .../htdocs/catalog/admin/model/tool/export.php on line 266Notice: Undefined offset: 16 in .../htdocs/catalog/admin/model/tool/export.php on line 269Notice: Undefined offset: 23 in .../htdocs/catalog/admin/model/tool/export.php on line 275Notice: Undefined offset: 24 in .../htdocs/catalog/admin/model/tool/export.php on line 276Error: 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 ''felina','0','0','0','','in',1,'testing agai',0,and finally,'data/felina-parchme' at line 1
Error No: 1064
INSERT INTO `product` (`product_id`,`quantity`,`sku`,`location`,`stock_status_id`,`model`,`cleaning_code`,`repeat_dir`,`xroll_dir`,`fabric_dir`,`roll_width`,`manufacturer_id`,`image`,`shipping`,`price`,`date_added`,`date_modified`,`date_available`,`weight`,`weight_class_id`,`status`,`tax_class_id`,`viewed`,`length`,`width`,`height`,`length_class_id`,`sort_order`,`subtract`,`minimum`,`cost`) VALUES (1,0,'','',,'felina','0','0','0','','in',1,'testing agai',0,and finally,'data/felina-parchment-500x500.jpg','','yes',0,0,0,0,lb,0,1,,'0','1','1','1',0);
This also pretty much boinks the product table in MySQL... so I have to drop all my tables and upload my backup .sql. Soooooo close!

The five new fields I'm trying to add are "cleaning_code", "repeat_dir", "xroll_dir", "fabric_dir", and "roll_width"... I've got them saving in the database via the backend product form, but not through the Excel. The Excel is critical though; these clients can export their products from the software they run into an OpenCart-readable format... If I can just get this going it'll be smooth sailing for the rest of the project...! Anybody understand this SQL? lol

Here is some of the code from admin/model/tool/export.php, the error seems to be here (dateModified is line 266):

Code: Select all

// generate and execute SQL for storing the products
		foreach ($products as $product) {
			$productId = $product[0];
			$productName = $database->escape($product[1]);
			$categories = $product[2];
			$quantity = $product[3];
			$model = $database->escape($product[5]);
			$manufacturerName = $product[6];
			$manufacturerId = ($manufacturerName=="") ? 0 : $manufacturerIds[$manufacturerName];
			$imageName = $product[7];
			$shipping = $product[9];
			$shipping = ((strtoupper($shipping)=="YES") || (strtoupper($shipping)=="Y")) ? 1 : 0;
			$price = trim($product[10]);
			$dateAdded = $product[12];
			$dateModified = $product[13];
			$dateAvailable = $product[14];
			$weight = ($product[15]=="") ? 0 : $product[15];
			$unit = $product[16];
			$weightClassId = (isset($weightClassIds[$unit])) ? $weightClassIds[$unit] : 0;
			$status = $product[17];
			$status = ((strtoupper($status)=="TRUE") || (strtoupper($status)=="YES") || (strtoupper($status)=="ENABLED")) ? 1 : 0;
			$taxClassId = $product[20];
			$viewed = $product[21];
			$productDescription = $database->escape($product[23]);
			$stockStatusId = $product[24];
			$meta_description = $database->escape($product[25]);
			$length = $product[26];
			$width = $product[27];
			$height = $product[28];
			$keyword = $database->escape($product[29]);
			$lengthUnit = $product[30];
			$cleaning_code = $database->escape($product[31]);
			$repeat_dir = $database->escape($product[32]);
			$xroll_dir = $database->escape($product[33]);
			$fabric_dir = $database->escape($product[34]);
			$roll_width = $database->escape($product[35]);
			$lengthClassId = (isset($lengthClassIds[$lengthUnit])) ? $lengthClassIds[$lengthUnit] : 0;
			$sku = $database->escape($product[36]);
			$location = $database->escape($product[37]);
			$storeIds = $product[38];
			$related = $product[39];
			$tags = $database->escape($product[40]);
			$subtract = $product[41];
			$subtract = ((strtoupper($subtract)=="TRUE") || (strtoupper($subtract)=="YES") || (strtoupper($subtract)=="ENABLED")) ? 1 : 0;
			$minimum = $product[42];
			$cost = trim($product[43]);
			$meta_keywords = $database->escape($product[44]);
			$sort_order = $product[45];
			$sql  = "INSERT INTO `".DB_PREFIX."product` (`product_id`,`quantity`,`sku`,`location`,";
			$sql .= "`stock_status_id`,`model`,`manufacturer_id`,`image`,`shipping`,`price`,`date_added`,`date_modified`,`date_available`,`weight`,`weight_class_id`,`status`,";
			$sql .= "`tax_class_id`,`viewed`,`length`,`width`,`height`,`length_class_id`,`cleaning_code`,`repeat_dir`,`xroll_dir`,`fabric_dir`,`roll_width`,`sort_order`,`subtract`,`minimum`,`cost`) VALUES ";
			$sql .= "($productId,$quantity,'$sku','$location',";
			$sql .= "$stockStatusId,'$model',$manufacturerId,'$imageName',$shipping,$price,";
			$sql .= ($dateAdded=='NOW()') ? "$dateAdded," : "'$dateAdded',";
			$sql .= ($dateModified=='NOW()') ? "$dateModified," : "'$dateModified',";
			$sql .= ($dateAvailable=='NOW()') ? "$dateAvailable," : "'$dateAvailable',";
			$sql .= "$weight,$weightClassId,$status,";
			$sql .= "$taxClassId,$viewed,$length,$width,$height,'$lengthClassId','$cleaning_code','$repeat_dir','$xroll_dir','$fabric_dir','$roll_width','$sort_order','$subtract','$minimum',$cost);";
			$sql2 = "INSERT INTO `".DB_PREFIX."product_description` (`product_id`,`language_id`,`name`,`description`,`meta_description`,`meta_keywords`) VALUES ";
			$sql2 .= "($productId,$languageId,'$productName','$productDescription','$meta_description','$meta_keywords');";
			$database->query($sql);
			$database->query($sql2);
			if (count($categories) > 0) {
				$sql = "INSERT INTO `".DB_PREFIX."product_to_category` (`product_id`,`category_id`) VALUES ";
				$first = TRUE;
				foreach ($categories as $categoryId) {
					$sql .= ($first) ? "\n" : ",\n";
					$first = FALSE;
					$sql .= "($productId,$categoryId)";
				}
				$sql .= ";";
				$database->query($sql);
			}
			if ($keyword) {
				$sql4 = "INSERT INTO `".DB_PREFIX."url_alias` (`query`,`keyword`) VALUES ('product_id=$productId','$keyword');";
				$database->query($sql4);
			}
			foreach ($storeIds as $storeId) {
				$sql6 = "INSERT INTO `".DB_PREFIX."product_to_store` (`product_id`,`store_id`) VALUES ($productId,$storeId);";
				$database->query($sql6);
			}
			if (count($related) > 0) {
				$sql = "INSERT INTO `".DB_PREFIX."product_related` (`product_id`,`related_id`) VALUES ";
				$first = TRUE;
				foreach ($related as $relatedId) {
					$sql .= ($first) ? "\n" : ",\n";
					$first = FALSE;
					$sql .= "($productId,$relatedId)";
				}
				$sql .= ";";
				$database->query($sql);
			}
			if (count($tags) > 0) {
				$sql = "INSERT INTO `".DB_PREFIX."product_tags` (`product_id`,`tag`,`language_id`) VALUES ";
				$first = TRUE;
				$inserted_tags = array();
				foreach ($tags as $tag) {
					if ($tag == '') {
						continue;
					}
					if (in_array($tag,$inserted_tags)) {
						continue;
					}
					$sql .= ($first) ? "\n" : ",\n";
					$first = FALSE;
					$sql .= "($productId,'".$database->escape($tag)."',$languageId)";
					$inserted_tags[] = $tag;
				}
				$sql .= ";";
				if (count($inserted_tags)>0) {
					$database->query($sql);
				}
			}
		}


New member

Posts

Joined
Thu Dec 17, 2009 1:30 am

Post by testingbykumar » Fri Apr 15, 2011 7:45 pm

Version 1.4.9.4
Notice: Undefined variable: column_price in D:\wamp\www\cbz\admin\view\template\catalog\product_list.tpl on line 35
---------
Notice: Undefined index: special in D:\wamp\www\cbz\admin\view\template\catalog\product_list.tpl on line 85 Notice: Undefined index: price in D:\wamp\www\cbz\admin\view\template\catalog\product_list.tpl on line 88


I did modification in below files

a. admin/controller/catalog/product.php
b. admin/language/english/catalog/product.php
c. admin/model/catalog/product.php
d. admin/view/template/catalog/product_form.tpl

Thanks in Advance


Posts

Joined
Fri Apr 15, 2011 1:25 am

Post by sans » Fri Apr 15, 2011 9:17 pm

testingbykumar wrote :
Version 1.4.9.4
Notice: Undefined variable: column_price in D:\wamp\www\cbz\admin\view\template\catalog\product_list.tpl on line 35
---------
Notice: Undefined index: special in D:\wamp\www\cbz\admin\view\template\catalog\product_list.tpl on line 85 Notice: Undefined index: price in D:\wamp\www\cbz\admin\view\template\catalog\product_list.tpl on line 88
Hi Kumar,
This is modification for OC 1.4.9-1.4.9.2 not suitable for 1.4.9.4. Yous must adapted that code in order to work at OC 1.4.9.4. Not only overwrite file.

kaos jersey, jersey bola, baju bola, baju bola terbaru, baju bola murah


Active Member

Posts

Joined
Tue Dec 07, 2010 9:18 am

Post by testingbykumar » Sat Apr 16, 2011 1:18 am

Hi

I modified each files and For Extra fields Value is gets inserted. I do not change anything in product_list.tpl
I do not know why it shows error.


Posts

Joined
Fri Apr 15, 2011 1:25 am

Post by thegeekz » Fri May 06, 2011 5:44 pm

Xsecrets wrote:It's not easy and takes some coding knowledge. There is the Product Extra Fields module which adds a new tab with admin definable fields. It modifies lots of core files because it pretty much has to. This functionality will be built into 1.5.0, but currently you either have to go with the Product Extra Fields mod or get your hands dirty coding.
Hi there..

I'm also looking for adding additional fields like Size to be shown to customers.

Just to confirm if version 1.50 will have it? I'm trying to decipher the meaning of this feature: Option Text Field as mentioned by Daniel.

My guess is this is it.

Another option I have I guess is to rename the Misc Location and then mod the core to have this field shown to the customers.

Please enlighten if I'm correct?

Thank you

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 nosecret » Fri May 06, 2011 11:59 pm

You can use my modification to add extra field in admin. And how to show that field displayed in product page? You can use hint from Q. Try check this link
http://forum.opencart.com/viewtopic.php ... ld#p106587

Active Member

Posts

Joined
Tue Dec 28, 2010 12:28 pm

Post by thegeekz » Wed May 11, 2011 12:00 pm

hmm but it seems ur mod is not suitable for 1.49.3 and above?

So is my guess correct that the 1.5.0 version will have this function?

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 nosecret » Wed May 11, 2011 9:36 pm

Yes, My modification not suitable for 1.4.9.3 or above. But, you can adapted that code in order to work at 1.4.9.3 or above. Just search word color or size in my file and copy paste to your file.

Active Member

Posts

Joined
Tue Dec 28, 2010 12:28 pm

Post by thegeekz » Thu May 12, 2011 2:31 pm

nosecret wrote:Yes, My modification not suitable for 1.4.9.3 or above. But, you can adapted that code in order to work at 1.4.9.3 or above. Just search word color or size in my file and copy paste to your file.
Hi nosecret.

I would very much like to do it on my own, but I'm not very confident in changing codings...

Would you be so kind to have it modified to suit 1.4.9.3 & above?

Thank you.

Rgds

Faustine

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
Who is online

Users browsing this forum: No registered users and 2 guests