Jump to content

Edit History

selin

selin

3 hours ago, phinq1910 said:

You have to turn off identity insert, insert the records then turn on identity insert back. 

Example:


ALTER TABLE ps_product DROP PRIMARY KEY,
MODIFY id_product INT PRIMARY KEY NOT NULL;

--insert commmand here....

ALTER TABLE ps_product DROP PRIMARY KEY,
MODIFY id_product INT AUTO_INCREMENT PRIMARY KEY NOT NULL;

 

Opps..

There is an error :

INSERT QUERY does not have id_product 

INSERT INTO `ps_product` 

(`id_shop_default`, `id_manufacturer`, `id_supplier`, `reference`, `supplier_reference`, `location`, `width`, `height`, `depth`, `weight`, `quantity_discount`, `ean13`, `isbn`, `upc`, `cache_is_pack`, `cache_has_attachments`, `is_virtual`, `state`, `additional_delivery_times`, `id_category_default`, `id_tax_rules_group`, `on_sale`, `online_only`, `ecotax`, `minimal_quantity`, `low_stock_threshold`, `low_stock_alert`, `price`, `wholesale_price`, `unity`, `unit_price_ratio`, `additional_shipping_cost`, `customizable`, `text_fields`, `uploadable_files`, `active`, `redirect_type`, `id_type_redirected`, `available_for_order`, `available_date`, `show_condition`, `condition`, `show_price`, `indexed`, `visibility`, `cache_default_attribute`, `advanced_stock_management`, `date_add`, `date_upd`, `pack_stock_type`) 

VALUES 

('1', '0', '2', '', '2', '', '0', '0', '0', '0', '0', '', '', '', '0', '0', '0', '1', '1', '0', '1', '0', '0', '0', '1', NULL, '0', '4', '0', '', '0', '0', '0', '0', '0', '1', '', '0', '1', '0000-00-00', '0', 'new', '1', '0', 'both', '0', '0', '2018-12-10 15:50:17', '2018-12-10 15:50:17', '3')

THEN

I updated classes/Product.php
 

/** @var int default Shop id */
    public $id_product;
...

bla

..

 'fields' => array(
            /* Classic fields */
            
            'id_product' =>                    array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
            'id_shop_default' =>            array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
            'id_manufacturer' =>            array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

Then,

I saved. but not listed in B.O Products page. Because, product's id is 1 at ps_product but,  0 at ps_product_lang table.

Any ideas? 

selin

selin

3 hours ago, phinq1910 said:

You have to turn off identity insert, insert the records then turn on identity insert back. 

Example:


ALTER TABLE ps_product DROP PRIMARY KEY,
MODIFY id_product INT PRIMARY KEY NOT NULL;

--insert commmand here....

ALTER TABLE ps_product DROP PRIMARY KEY,
MODIFY id_product INT AUTO_INCREMENT PRIMARY KEY NOT NULL;

 

Opps..

There is an error :

INSERT QUERY does not have id_product 

INSERT INTO `ps_product` 

(`id_shop_default`, `id_manufacturer`, `id_supplier`, `reference`, `supplier_reference`, `location`, `width`, `height`, `depth`, `weight`, `quantity_discount`, `ean13`, `isbn`, `upc`, `cache_is_pack`, `cache_has_attachments`, `is_virtual`, `state`, `additional_delivery_times`, `id_category_default`, `id_tax_rules_group`, `on_sale`, `online_only`, `ecotax`, `minimal_quantity`, `low_stock_threshold`, `low_stock_alert`, `price`, `wholesale_price`, `unity`, `unit_price_ratio`, `additional_shipping_cost`, `customizable`, `text_fields`, `uploadable_files`, `active`, `redirect_type`, `id_type_redirected`, `available_for_order`, `available_date`, `show_condition`, `condition`, `show_price`, `indexed`, `visibility`, `cache_default_attribute`, `advanced_stock_management`, `date_add`, `date_upd`, `pack_stock_type`) 

VALUES 

('1', '0', '2', '', '2', '', '0', '0', '0', '0', '0', '', '', '', '0', '0', '0', '1', '1', '0', '1', '0', '0', '0', '1', NULL, '0', '4', '0', '', '0', '0', '0', '0', '0', '1', '', '0', '1', '0000-00-00', '0', 'new', '1', '0', 'both', '0', '0', '2018-12-10 15:50:17', '2018-12-10 15:50:17', '3')

THEN

I updated classes/Product.php
 

/** @var int default Shop id */
    public $id_product;
...

bla

..

 'fields' => array(
            /* Classic fields */
            
            'id_product' =>                    array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
            'id_shop_default' =>            array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
            'id_manufacturer' =>            array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

Then,

I saved. but not listed in B.O Products page. Because, product's id is 0 at _lang table.

Any ideas? 

selin

selin

3 hours ago, phinq1910 said:

You have to turn off identity insert, insert the records then turn on identity insert back. 

Example:


ALTER TABLE ps_product DROP PRIMARY KEY,
MODIFY id_product INT PRIMARY KEY NOT NULL;

--insert commmand here....

ALTER TABLE ps_product DROP PRIMARY KEY,
MODIFY id_product INT AUTO_INCREMENT PRIMARY KEY NOT NULL;

 

Opps..

There is an error :

INSERT QUERY does not have id_product 

INSERT INTO `ps_product` 

(`id_shop_default`, `id_manufacturer`, `id_supplier`, `reference`, `supplier_reference`, `location`, `width`, `height`, `depth`, `weight`, `quantity_discount`, `ean13`, `isbn`, `upc`, `cache_is_pack`, `cache_has_attachments`, `is_virtual`, `state`, `additional_delivery_times`, `id_category_default`, `id_tax_rules_group`, `on_sale`, `online_only`, `ecotax`, `minimal_quantity`, `low_stock_threshold`, `low_stock_alert`, `price`, `wholesale_price`, `unity`, `unit_price_ratio`, `additional_shipping_cost`, `customizable`, `text_fields`, `uploadable_files`, `active`, `redirect_type`, `id_type_redirected`, `available_for_order`, `available_date`, `show_condition`, `condition`, `show_price`, `indexed`, `visibility`, `cache_default_attribute`, `advanced_stock_management`, `date_add`, `date_upd`, `pack_stock_type`) 

VALUES 

('1', '0', '2', '', '2', '', '0', '0', '0', '0', '0', '', '', '', '0', '0', '0', '1', '1', '0', '1', '0', '0', '0', '1', NULL, '0', '4', '0', '', '0', '0', '0', '0', '0', '1', '', '0', '1', '0000-00-00', '0', 'new', '1', '0', 'both', '0', '0', '2018-12-10 15:50:17', '2018-12-10 15:50:17', '3')

THEN

I updated classes/Product.php
 

/** @var int default Shop id */
    public $id_product;
...

bla

..

 'fields' => array(
            /* Classic fields */
            
            'id_product' =>                    array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
            'id_shop_default' =>            array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
            'id_manufacturer' =>            array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

Then,

I saved. but not listed in B.O Products page.

Any ideas? :(

×
×
  • Create New...