Tags/topics: 
4
Answers
Vote up!
0
Vote down!

Product Import - Prices showing only on some items in products view

I ran the queries below to import over 1,000 products taken from a spreadsheet that we got from the wholesaler. The prices are not showing on about half the items in products view, even though they were all imported in the same way.

I first created an import table with the following:

CREATE TABLE `lunker_import`
(`product_id` int(10) unsigned NOT NULL,
`revision_id` int(10) unsigned NOT NULL,
`wholesaler_id` varchar(4) NOT NULL,
`sku` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`uid` int(11) NOT NULL,
`status` tinyint(4) NOT NULL,
`created_date` int(11) NOT NULL,
`changed_date` int(11) NOT NULL,
`selling_price` double(20,7) NOT NULL,
`converted_price` int(11) NOT NULL);

I then imported the product list:

insert into lunker_import
(product_id,revision_id,wholesaler_id,sku,title,type,uid,status,created_date,changed_date,selling_price,converted_price)

VALUES
('1','1','A001','001-001','Zoom U-Tail 6" 20bag Blk/Red Glitter','product','1','1','1345329276','1345329276','2.97005','297'),
('2','2','A001','001-003','Zoom U-Tail 6" 20/bag Electric Blue','product','1','1','1345329276','1345329276','2.97005','297'),
('3','3','A001','001-004','Zoom U-Tail 6" 20/bag Plum','product','1','1','1345329276','1345329276','2.97005','297'),
.....1,000+ products here;

Now that I have the products in the database, I then updated 3 tables:

/* commerce_product */
INSERT INTO commerce_product
(product_id, revision_id, sku, title, type, uid, status, created, changed)
select product_id, revision_id, sku, title, type, uid, status, created_date, changed_date
from lunker_import;

/* commerce_product_revision */
INSERT INTO commerce_product_revision
(product_id, revision_id, sku, title, revision_uid, status, revision_timestamp)
select product_id, revision_id, sku, title, uid, status, created_date
from lunker_import;

/* field_data_commerce_price */
INSERT INTO field_data_commerce_price
(entity_id, revision_id, commerce_price_amount)
select product_id, revision_id, converted_price from lunker_import;

update field_data_commerce_price set entity_type='commerce_product', bundle='product',deleted='0',delta='0',commerce_price_currency_code='USD',commerce_price_data='a:1:{s:10:"components";a:0:{}}';

I've queried every single table in Drupal to see if I missed something, or if there is a table that is showing partial data. I've also looked at the data, and have not seen any difference between the records that display and the records that don't.

Any help or suggestions would be appreciated. Thank you!

Asked by: ndavidg
on August 20, 2012

4 Answers

Vote up!
0
Vote down!

Never mind. I installed Commerce Feeds. I'll get fancy with the SQL codez another day.

Answer by: Anonymous (not verified)
Posted: Aug 20, 2012
Vote up!
0
Vote down!

The above post was mine, by the way... hadn't logged in.

Answer by: ndavidg
Posted: Aug 20, 2012
Vote up!
0
Vote down!

Update... had a similar issue with Commerce Feeds, where not all products imported. I ended up converting all double quotes to "in" using find/replace. There were a few sneaky double single quotes which appeared to be inches as well, though I'll get clarification later. Converted csv file to UTF-8 using notepad, then imported using Commerce Fields. All products imported this time. Whew. Time for a beer :-)

Answer by: ndavidg
Posted: Aug 20, 2012
Vote up!
0
Vote down!

Correction above: Commerce Fields=Commerce Feeds Product Importer

Answer by: ndavidg
Posted: Aug 20, 2012