3 Issues to fix MULTIPLE PRODUCT CHECKOUT
REQUIREMENTS
PHP MYSQL skills
YOUR IP ADDRESS for htaccess to allow access
If you are experienced with PHP and MYSQL, this project can be done in 3 hours.
#[login to view URL] different prodcut (item_id) is sotred in a row as pending before chekout.
once shopper completed checkout, the each product should be FOREACH and insert into ordered table as each diffrent row with its detail included other table’s data.
each order row for each product should have its own item_id, price, color, size, quantity,,,( you can confirm the value in the below queries)
But here only insert one product and needed to be fix.
#[login to view URL] checkout, each item stock number should be decreased by the number of its purchased.
#3. Add case of “Delete only purchased item in shopping cart if there is uncheckout item remains”
to DELETE shopping cart WHERE ID=shopper
DETAILS
#1
example.
Shopper is about to checkout 3 products in shopping cart and this is saved as pending as
INSERT INTO `bx_pmt_ordres_pending` (`id`, `order_id`, `client_id`, `seller_id`, `item_type`, `items`, `amount`, `shp_amt`, `currency`, `b_currency`, `b_amount`, `b_shpamt`, `shp_type`, `provider`, `error_code`, `error_msg`, `txn_id`, `date`, `shp_id`) VALUES
(460, '94VP2S55F98GR1VY', 5479, 5606, 'P', '5606_31_533_1:5606_31_531_1:5606_31_534_1', 934.5, 60, 'USD', 'USD', 934.5, 20, 'pp', 'paypal', '', '', '', '1395897518', 16);
Once checkout has completed, below has inserted include table in blue but red row is missing.
INSERT INTO `bx_pmt_ordres` (`id`, `pending_id`, `txn_id`, `client_id`, `seller_id`, `module_id`, `item_id`, `color`, `size`, `option`, `item_count`, `amount`, `shp_amount`, `option_amt`, `s_currency`, `s_amount`, `s_shpamt`, `s_optionamt`, `b_currency`, `b_amount`, `b_shpamt`, `b_optionamt`, `buyer_status`, `seller_status`, `tracking_code`, `seller_pmt_status`, `admin_pmt_status`, `date`) VALUES
(222, 460, '', 5479, 5606, 31, 533, 'Black', 'M', 'no', 1, 934.5, 20, 0, 'USD', 934.5, 20, 0, 'USD', 934.5, 20, 0, 'n', 'n', '', 'n', 'n', '1395897550');
(222, 460, '', 5479, 5606, 31, 531, 'White', 'L', 'no', 1, 189.50, 20, 0, 'USD', 189.50, 20, 0, 'USD', 189.50, 20, 0, 'n', 'n', '', 'n', 'n', '1395897550');
(222, 460, '', 5479, 5606, 31, 534, 'Black', '4', 'no', 1, 690.0, 20, 0, 'USD', 690.0, 20, 0, 'USD', 690.0, 20, 0, 'n', 'n', '', 'n', 'n', '1395897550');
INSERT INTO `bx_store_product_files` (`id`, `author_id`, `entry_id`, `media_id`, `price`, `allow_purchase_to`, `hidden`, `color`, `size`, `store_type`, `stock_num`, `cond`) VALUES
(531, 5606, 486, 0, '189.50', '4', 0, 'White', 'L', 'P', 2, 0),
(533, 5606, 488, 0, '55.00', '4', 0, 'Black', 'M', 'P', 1, 0),
(534, 5606, 489, 0, '690.00', '4', 0, 'Black', '4', 'P', 2, 0);
#2
example.
$updateStockSql = 'UPDATE bx_store_product_files SET stock_num=stock_num-'.$item_count.' WHERE id='.$item_id.' ';
echo $updateStockSql;exit;
mysql_query($updateStockSql) or die(mysql_error());
#2
example. only value in purple should be deleted
INSERT INTO `bx_pmt_cart` (`client_id`, `items`) VALUES
(5479, '177_31_510_1:177_31_509_1':5606_31_533_1:5606_31_531_1:5606_31_534_1);
The project should be consider as completed only when checkout sql insert test clears
@each of products has confirmed as order as each ( inserted into different row )
@product stock number has decrease the number of purchased quantity
@only purchased item(s) has deleted in shopping bag
Please also find the target code with better visual from the link below.
[login to view URL]
table structure
[login to view URL]