- Posts: 41
- Thank you received: 0
Error on Import
11 years 7 months ago #191896
by gteigland
Error on Import was created by gteigland
-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.6.3
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : 1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3_hikashop_product_related (`product_related_id`,`product_related_type`,`product_id`) VALUES ()
Not really sure why this error would happen. Here are the steps. (furnitureandthings.com - upgrade to joomla 3)
1. I exported my products from hikashop2.3.5 FOR JOOMLA 2.5.28 (from live site)
2. Created fresh JOOMLA 3.3.6 site on local machine. Loaded hikashop version 2.3.5 (so it matches)
3. Imported product list (from step 1)
And this error shows up. Pleae explain the issue. I would think it should be seamless.
awesomescreenshot.com/0a34gzhp2b
Thanks!
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.6.3
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : 1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3_hikashop_product_related (`product_related_id`,`product_related_type`,`product_id`) VALUES ()
Not really sure why this error would happen. Here are the steps. (furnitureandthings.com - upgrade to joomla 3)
1. I exported my products from hikashop2.3.5 FOR JOOMLA 2.5.28 (from live site)
2. Created fresh JOOMLA 3.3.6 site on local machine. Loaded hikashop version 2.3.5 (so it matches)
3. Imported product list (from step 1)
And this error shows up. Pleae explain the issue. I would think it should be seamless.
awesomescreenshot.com/0a34gzhp2b
Thanks!
Please Log in or Create an account to join the conversation.
11 years 7 months ago #192112
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Error on Import
Hi,
I check the code of the import but I find something which could explain your issue.
In the file "administrator/components/com_hikashop/helpers/import.php", you will find the function "_insertRelated".
In this function, please replace the two references of
By
And it should fix your issue.
Near the end of the function, you can also replace
By
Regards,
I check the code of the import but I find something which could explain your issue.
In the file "administrator/components/com_hikashop/helpers/import.php", you will find the function "_insertRelated".
In this function, please replace the two references of
Code:
if( $totalValid%$this->perBatch == 0){
Code:
if( $totalValid && $totalValid%$this->perBatch == 0){
Near the end of the function, you can also replace
Code:
if(!empty($values)){
Code:
if(count($values) > 0){
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
11 years 7 months ago #192835
by gteigland
Replied by gteigland on topic Error on Import
Unfortunately that did not work. I still get this error:
1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3_hikashop_product_related (`product_related_id`,`product_related_type`,`product_id`) VALUES ()
I reverted back to the original. Realy need this to work as these products have many related products and I would think we should be able to export and import seamlessly between hikashop.
Thanks!
1136 Column count doesn't match value count at row 1 SQL=INSERT IGNORE INTO jbar3_hikashop_product_related (`product_related_id`,`product_related_type`,`product_id`) VALUES ()
I reverted back to the original. Realy need this to work as these products have many related products and I would think we should be able to export and import seamlessly between hikashop.
Thanks!
Please Log in or Create an account to join the conversation.
11 years 7 months ago #192901
by Xavier
Replied by Xavier on topic Error on Import
Hi,
Please replace the whole content of the function by:
Please replace the whole content of the function by:
Code:
function _insertRelated(&$products,$type='related'){
$values = array();
$totalValid=0;
$insert = 'INSERT IGNORE INTO '.hikashop_table('product_related').' (`product_related_id`,`product_related_type`,`product_id`) VALUES (';
$ids=array();
foreach($products as $product){
if(!isset($product->$type) && empty($product->hikashop_update)){
//copy files from template if any
if(@$product->product_type!='variant' && !empty($this->template->$type)){
foreach($this->template->$type as $id){
$value = array((int)$id,$this->db->Quote($type),$product->product_id);
$values[] = implode(',',$value);
$totalValid++;
if( $totalValid && $totalValid%$this->perBatch == 0){
$this->db->setQuery($insert.implode('),(',$values).')');
$this->db->query();
$totalValid=0;
$values=array();
}
}
}
}elseif(isset($product->$type)&&is_array($product->$type)){
$ids[] = (int)$product->product_id;
foreach($product->$type as $k => $id){
if(!empty($id)){
$id = $this->_getRelated($id);
$product->{$type}[$k] = $id;
$value = array((int)$id,$this->db->Quote($type),$product->product_id);
$values[] = implode(',',$value);
$totalValid++;
}
if( $totalValid && $totalValid%$this->perBatch == 0){
if(!empty($ids)){
$this->db->setQuery('DELETE FROM '.hikashop_table('product_related').' WHERE product_id IN ('.implode(',',$ids).') AND product_related_type='.$this->db->Quote($type));
$this->db->query();
$ids=array();
}
if(!empty($id)){
$this->db->setQuery($insert.implode('),(',$values).')');
$this->db->query();
}
$totalValid=0;
$values=array();
}
}
}
}
if(!empty($ids)){
$this->db->setQuery('DELETE FROM '.hikashop_table('product_related').' WHERE product_id IN ('.implode(',',$ids).') AND product_related_type='.$this->db->Quote($type));
$this->db->query();
}
if(count($values)){
$this->db->setQuery($insert.implode('),(',$values).')');
$this->db->query();
}
}
The following user(s) said Thank You: gteigland
Please Log in or Create an account to join the conversation.
Time to create page: 0.162 seconds