Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

limor01

Archived
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Real Name
    don

limor01's Achievements

  1. Another approach to order completion this way almost no files are changed on the core OSC code this is just a sample not a complete code 1. force all bidding users to enter credit card info before bidding. 2. When the auction is closed create an order 3. delete all non winning customers credit card details function tep_create_auction_order($auction_id) { global $currencies, $languages_id; // ================================================================================ = $auction_data_query = tep_db_query("select * from auctions where auctions_id='".(int)$auction_id . "'"); $auction_data_row = tep_db_fetch_array($auction_data_query); $customer_id = $auction_data_row['auctions_high_cust']; $auction_closed_time = $auction_data_row['expires_date']; $auction_produtcs_id = $auction_data_row['products_id']; $auction_produtcs_price = $auction_data_row['auctions_max']; $auction_shipp_handle_price = $auction_data_row['auctions_shipp_handle_price']; $customer_data_query = tep_db_query("select * from customers where customers_id='".(int)$customer_id . "'"); $customer_data_row = tep_db_fetch_array($customer_data_query); $customers_default_address_id = $customer_data_row['customers_default_address_id']; $customer_address_query = tep_db_query("select * from address_book where address_book_id='".$customers_default_address_id."' and customers_id='".(int)$customer_id . "'"); $customer_address_row = tep_db_fetch_array($customer_address_query); $product_data_query = tep_db_query("select products_name from products_description where language_id='".$languages_id."' and products_id='".(int)$auction_produtcs_id . "'"); $product_data_row = tep_db_fetch_array($product_data_query); $auction_product_name = $product_data_row['products_name']; // ================================================================================ = $sql_data_array = array('customers_id' => $customer_id, 'customers_name' => $customer_data_row['customers_firstname'] . ' ' . $customer_data_row['customers_lastname'], 'customers_street_address' => $customer_address_row['entry_street_address'], 'customers_city' => $customer_address_row['entry_city'], 'customers_postcode' => $customer_address_row['entry_postcode'], 'customers_state' => $customer_address_row['entry_state'], 'customers_country' => $customer_address_row['entry_country_id'], 'customers_telephone' => $customer_data_row['customers_telephone'], 'customers_email_address' => $customer_data_row['customers_email_address'], 'customers_address_format_id' => 1, 'delivery_name' => $customer_data_row['customers_firstname'] . ' ' . $customer_data_row['customers_lastname'], 'delivery_street_address' => $customer_address_row['entry_street_address'], 'delivery_city' => $customer_address_row['entry_city'], 'delivery_postcode' => $customer_address_row['entry_postcode'], 'delivery_state' => $customer_address_row['entry_state'], 'delivery_country' => $customer_address_row['entry_country_id'], 'ip_address' => "TBD", 'delivery_address_format_id' => 1, 'date_purchased' => $auction_closed_time, 'orders_status' => 2, 'currency' => "ILS", 'currency_value' => '1'); tep_db_perform(TABLE_ORDERS, $sql_data_array); $insert_id = tep_db_insert_id(); // ================================================================================ = $sql_data_array = array('orders_id' => $insert_id, 'new_value' => $new_value, 'date_added' => 'now()'); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); // ================================================================================ = $sql_data_array = array('orders_id' => $insert_id, 'products_id' => $auction_produtcs_id, 'products_tax' => '0', 'products_quantity' => '1', 'products_name' => 'æëéä áîëøæ (î÷"è '.$auction_produtcs_id .") " . $auction_product_name, 'products_price' => $auction_produtcs_price, 'final_price' => $auction_produtcs_price, 'products_stock_attributes' => ''); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); // ================================================================================ = $sql_data_array = array('orders_id' => $insert_id, 'title' => "Sub total:", 'text' => $currencies->display_price($auction_produtcs_price, 0), 'value' => $auction_produtcs_price, 'class' => "ot_subtotal", 'sort_order' => "1"); tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); // ================================================================================ = $sql_data_array = array('orders_id' => $insert_id, 'title' => "Shipping & Handling:", 'text' => $currencies->display_price($auction_shipp_handle_price, 0), 'value' => $auction_shipp_handle_price, 'class' => "ot_custom", 'sort_order' => "2"); tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); // ================================================================================ = $total_amount = $auction_produtcs_price + $auction_shipp_handle_price; $sql_data_array = array('orders_id' => $insert_id, 'title' => "Total:", 'text' => $currencies->display_price($total_amount, 0), 'value' => $total_amount, 'class' => "ot_total", 'sort_order' => "4"); tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); // ================================================================================ = // update order attributes // update auction - order created successfully }
  2. I am looking at the latest version. several lines bellow your new code I marked the line in underline bold italic red :-) function calculate() { global $currencies; $this->total = 0; $this->weight = 0; if (!is_array($this->contents)) return 0; reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); if ($product = tep_db_fetch_array($product_query)) { $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_weight = $product['products_weight']; // BOF AUCTIONS if( isset($this->contents[$products_id]['auction_id']) && $this->contents[$products_id]['auction_id'] > '0' ){ $this->total += $currencies->calculate_price($this->contents[$products_id]['auction_price'], $products_tax, '1'); } // EOF AUCTIONS $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'"); if (tep_db_num_rows ($specials_query)) { $specials = tep_db_fetch_array($specials_query); $products_price = $specials['specials_new_products_price']; } $this->total += $currencies->calculate_price($products_price, $products_tax, $qty); $this->weight += ($qty * $products_weight); } // attributes price if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '+') { $this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty); } else { $this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty); } } } } }
  3. Hello Guys! I managed to install this contribution in a 2002 osc! GREAT WORK! I think that I have found a Possible bug, I had no time to go through this entire topic in this forum. If this is a known issue, please ignore. in file /includes/classes/shopping_cart.php code: // BOF AUCTIONS if( isset($this->contents[$products_id]['auction_id']) && $this->contents[$products_id]['auction_id'] > '0' ){ $this->total += $currencies->calculate_price($this->contents[$products_id]['auction_price'], $products_tax, '1'); } $this->total += tep_add_tax($products_price, $products_tax) * $qty; should be: // BOF AUCTIONS if( isset($this->contents[$products_id]['auction_id']) && $this->contents[$products_id]['auction_id'] > '0' ){ $this->total += $currencies->calculate_price($this->contents[$products_id]['auction_price'], $products_tax, '1'); } else $this->total += tep_add_tax($products_price, $products_tax) * $qty; Thanks D
  4. limor01

    Is that a bug?

    I know that... You didnt read the original paypal IPN code. I was refering the fact that the wrong variable was used. My bold text is the variable that I think should have been used.
  5. Hello I have been using the module for a month now. I have never been able to see the order in "PayPal IPN - Start" status. The order information is saved on the confirmation() function but the status is taken from the order object instead of the member variable $order_status of this class. So I fixed it by adding the variable to the class declaration like: class paypal_ipn { var $code, $title, $description, $enabled, $identifier, $order_status; and if ((int)MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID > 0) { $this->order_status = (int)MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID; } and made the following change to the data array sent to the database: $sql_data_array = array('customers_id' => $customer_id, bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 'orders_status' => $this->order_status, bla bla bla bla bla bla bla bla bla bla bla bla ); also in //+1.4 $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $this->order_status, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => $order->info['comments']); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); //-1.4 All of this looks like something nobody can miss so I am thinking I did a mess :-) and this is not a bug as I think. The code goes back so long that I am not sure If my fix is true. Thanks
  6. limor01

    Is that a bug?

    Hello I have been using the module for a month now. I have never been able to see the order in "PayPal IPN - Start" status. The order information is saved on the confirmation() function but the status is taken from the order object instead of the member variable $order_status of this class. So I fixed it by adding the variable to the class declaration like: class paypal_ipn { var $code, $title, $description, $enabled, $identifier, $order_status; and if ((int)MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID > 0) { $this->order_status = (int)MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID; } and made the following change to the data array sent to the database: $sql_data_array = array('customers_id' => $customer_id, bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 'orders_status' => $this->order_status, bla bla bla bla bla bla bla bla bla bla bla bla ); also in //+1.4 $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $this->order_status, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => $order->info['comments']); tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); //-1.4 All of this looks like something nobody can miss so I am thinking I did a mess :-) and this is not a bug as I think. The code goes back so long that I am not sure If my fix is true. Thanks
  7. show me the exact code and not only the query.
  8. Excelent idea that needs more work. 1. it has SQL injection risks. you need to make sure you clean the data from the URL before you insert it into your database as a query. like: $mfo_auction_query = mysql_fetch_object(tep_db_query('select auctions_starting_price, expires_date, overbid_amount from ' . TABLE_AUCTIONS_PRODUCTS . ' where products_id = ' . $_GET['products_id'] . ' and status')); 2. it has many bugs in implementation and design. For instance, If you use a module to make some of the code why not use two modules to make product_info as clean as possible. 3. Timestamp is not saved in the bid, mistakes with table names, forgotten code parts. fixed: $sql_auction = "insert into ".TABLE_AUCTIONS_BIDS." (auctions_bids_id, auctions_id,customers_id,bid_price,bid_status, bid_date_added) values('','$auction_id','$customers_id','$bid_price', '', now())"; thanks I hope to add some bug fixes to this post.
  9. Excelent idea that needs more work. 1. it has SQL injection risks. you need to make sure you clean the data from the URL before you insert it into your database as a query. like: $mfo_auction_query = mysql_fetch_object( tep_db_query('select auctions_starting_price, expires_date, overbid_amount from ' . TABLE_AUCTIONS_PRODUCTS . ' where products_id = ' . $_GET['products_id'] . ' and status')); 2. it has many bugs in implementation and design. For instance, If you use a module to make some of the code why not use two modules to make product_info as clean as possible. 3. Timestamp is not saved in the bid, mistakes with table names, forgotten code parts. fixed: $sql_auction = "insert into ".TABLE_AUCTIONS_BIDS." (auctions_bids_id, auctions_id,customers_id,bid_price,bid_status, bid_date_added) values('','$auction_id','$customers_id','$bid_price', '', now())"; thanks I hope to add some bug fixes to this post.
  10. You need to copy the files into the proper places and activate the module under the admin. I recommend having a development directory with all the shop files and a copy of the database for tests purposes. It is too hard to explain how to follow the contribution installation without prior exprience. a test shop will enable you to play with the system without loosing uptime. look at the structure of the zip file and copy the files to the same locations under the catalog directories. it is in the same structure. also add the code into the files described in the installation file to the places as described in that file. I hope you succeed.
  11. First of all there is a fix: http://www.oscommerce.com/community/contributions,521 D S L
  12. Hello, I am not too good in development and good in integration :-) So I will give it a try and see where it goes. Thanks!!
  13. Hello all, I am using qtpro with my test shop and I am very pleased. I am about to add it to my live shop but must have QTPRO stock functionality in the order editing tool. Did anyone add the QTPRO stock management to the order editng contribution ? Or maybe someone wrote a function like update_stock_item(int $product_id, int $quantity, array $product_attributes)? Thanks, Limor
  14. Hi, When in sequenced dropdowns and a stock record exists and it is a quantity of 0 items for multiple attributes product I get the following : Warning: Invalid argument supplied for foreach() in /sites/shop....com/includes/classes/pad_base.php on line 443 Setting to a single dropdown will solve this error. thanks
  15. Hi, I think that I have found a problem with quantity getting negative. if you set two attributes as a "dont track stock" and then set them to the same product and have only one in stock. Add the product TWICE to the cart with different options selected. This will cause a successfull checkout and stock getting negative. thanks
×
×
  • Create New...