Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

WS Evolution

Archived
  • Posts

    189
  • Joined

  • Last visited

About WS Evolution

  • Birthday 10/27/1977

Profile Information

  • Real Name
    Gareth
  • Gender
    Male
  • Location
    York, North Yorkshire, UK
  • Interests
    E-commerce, Botanics, Weather, Rugby
  • Website

WS Evolution's Achievements

  1. I have just tested and it seems to work :) Will have to test with multiple products , multiple attributes and any other different combination I can think of.
  2. I have also found that $attribute['track_stock'] is also missing, but rather than adding it I have commented out the if statement as all attribute options will be stock controlled. // if ($attribute['track_stock'] == 1) { $products_stock_attributes_array[] = $attribute['options_id'] . "-" . $attribute['values_id']; $all_nonstocked = false; //}
  3. To get access to option ID and value ID I am going to add them to the orders_products_attributes table: // Gareth paypal-IPN QTpro //$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename //Gareth added pa.options_values_id, pa.options_id for paypal ipn with stock control attributes ! $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, pa.options_values_id, pa.options_id from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad on pa.products_attributes_id=pad.products_attributes_id where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"; $attributes = tep_db_query($attributes_query); } else { //Gareth added pa.options_values_id, pa.options_id for paypal ipn with stock control attributes ! $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.options_values_id, pa.options_id from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); // paypal-IPN QTpro } $attributes_values = tep_db_fetch_array($attributes); $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix'], // Gareth paypal-IPN QTpro Add options_values_id, pa.options_id to orders product attributes table 'options_id' => $attributes_values['options_id'], 'options_values_id' => $attributes_values['options_values_id']); // end paypal-IPN QTpro I can then add option ID and value ID to $this->products[$index]['attributes'][$subindex] IN classes/order.php: $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix, options_values_id, options_id from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'"); if (tep_db_num_rows($attributes_query)) { while ($attributes = tep_db_fetch_array($attributes_query)) { // Gareth paypal-IPN QTpro added: options_values_id, options_id $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price'], // Gareth paypal-IPN QTpro 'options_id' => $attributes['options_id'], 'values_id' => $attributes['options_values_id']);
  4. I am aiming to crack this once and for all! 1.3 Paypal IPN with qtpro integrated does not work if the customer fails to return to the site. The point of IPN is they don't have to return!. Therefore you need to move the code that deals with updating the stock to ipn.php rather than integrating all of it into paypal_ipn.php. I am attempting to integrate qtpro with paypal_ipn.php,v 2.3.0.0. After moving the relevant code to ipn.php I have found that $order->products[$i]['attributes'] is taken from the orders table (from function query() in classes/orders.php) which does not include option ID and value ID needed for the stock update quarry. order array with attributes from order tables $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'"); if (tep_db_num_rows($attributes_query)) { while ($attributes = tep_db_fetch_array($attributes_query)) { $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']); $subindex++; } } paypal_ipn.php accessed option ID and value ID using function cart() in classes/orders.php . order array with attributes from product tables if ($products[$i]['attributes']) { $subindex = 0; reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { //++++ QT Pro: Begin Changed code $attributes_query = tep_db_query("select popt.products_options_name, popt.products_options_track_stock, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); //++++ QT Pro: End Changed Code $attributes = tep_db_fetch_array($attributes_query); //++++ QT Pro: Begin Changed code $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price'], 'track_stock' => $attributes['products_options_track_stock']); //++++ QT Pro: End Changed Code $subindex++; } } The next step is to access option_id and value_id in ipn.php so the line $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'"; does not have missing values! Here is the relevant code in ipn.php ! // let's update the stock ####################################################### for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // PRODUCT LOOP STARTS HERE // Stock Update - Joao Correia //++++ QT Pro: Begin Changed code $products_stock_attributes=null; if (STOCK_LIMITED == 'true') { $products_attributes = $order->products[$i]['attributes']; // if (DOWNLOAD_ENABLED == 'true') { //++++ QT Pro: End Changed Code $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id=pa.products_id LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id=pad.products_attributes_id WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop //++++ QT Pro: Begin Changed code // $products_attributes = $order->products[$i]['attributes']; //++++ QT Pro: End Changed Code if (is_array($products_attributes)) { /// Problem no option_id in $products_attributes array $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'"; $debug = " ********* $products_attributes[0]['option_id'] = " . $products_attributes[0]['option_id']; $debug .= " ********* $products_attributes[0][value_id] = " . $products_attributes[0]['value_id']; $debug .= "---------" . '<pre>'. print_r($products_attributes, TRUE) .'</pre>'; } $stock_query = tep_db_query($stock_query_raw); } else { $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); //++++ QT Pro: Begin Changed code $actual_stock_bought = $order->products[$i]['qty']; $download_selected = false; if ((DOWNLOAD_ENABLED == 'true') && isset($stock_values['products_attributes_filename']) && tep_not_null($stock_values['products_attributes_filename'])) { $download_selected = true; $products_stock_attributes='$$DOWNLOAD$$'; } // If not downloadable and attributes present, adjust attribute stock if (!$download_selected && is_array($products_attributes)) { $all_nonstocked = true; $products_stock_attributes_array = array(); foreach ($products_attributes as $attribute) { if ($attribute['track_stock'] == 1) { $products_stock_attributes_array[] = $attribute['option_id'] . "-" . $attribute['value_id']; $all_nonstocked = false; } } if ($all_nonstocked) { $actual_stock_bought = $order->products[$i]['qty']; } else { asort($products_stock_attributes_array, SORT_NUMERIC); $products_stock_attributes = implode(",", $products_stock_attributes_array); $attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if (tep_db_num_rows($attributes_stock_query) > 0) { $attributes_stock_values = tep_db_fetch_array($attributes_stock_query); $attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty']; tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); $actual_stock_bought = ($attributes_stock_left < 1) ? $attributes_stock_values['products_stock_quantity'] : $order->products[$i]['qty']; } else { $attributes_stock_left = 0 - $order->products[$i]['qty']; tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " (products_id, products_stock_attributes, products_stock_quantity) values ('" . tep_get_prid($order->products[$i]['id']) . "', '" . $products_stock_attributes . "', '" . $attributes_stock_left . "')"); $actual_stock_bought = 0; } } } // $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); // } // if (tep_db_num_rows($stock_query) > 0) { // $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists if (!$download_selected) { $stock_left = $stock_values['products_quantity'] - $actual_stock_bought; tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - '" . $actual_stock_bought . "' WHERE products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); //++++ QT Pro: End Changed Code if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } } } // Update products_ordered (for bestsellers list) tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); //++++ QT Pro: Begin Changed code if (!isset($products_stock_attributes)) $products_stock_attributes=null; $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty'], 'products_stock_attributes' => $products_stock_attributes); //++++ QT Pro: End Changed Code tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = tep_db_insert_id(); // Let's get all the info together for the email $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']); $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty']; $total_cost += $total_products_price; // Let's get the attributes $products_ordered_attributes = ''; if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) { for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) { $products_ordered_attributes .= "\n\t" . $order->products[$i]['attributes'][$j]['option'] . ' ' . $order->products[$i]['attributes'][$j]['value']; } } // Let's format the products model $products_model = ''; if ( !empty($order->products[$i]['model']) ) { $products_model = ' (' . $order->products[$i]['model'] . ')'; } // Let's put all the product info together into a string $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . $products_model . ' = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; } // PRODUCT LOOP ENDS HERE ####################################################### Any assistance would be very welcome :thumbsup: .
  5. I have also discover that FPDF class is already defined using the "class_exists()" function. I think this may be cause of the problem. If the version I am using (1.3) if different I guess this explains the problems. How can I find out where the class is being called? I can't find any other occurrences when the call is called. If I comment out line 550 the moves to 552 and so on... therefore it seems all the function don't work inside output_table_heading().
  6. I get the following error: Call to a member function on a non-object in /***/***/***/pdfinvoice.php on line 550 function output_table_heading($Y_Fields_Name_position){ global $pdf, $cell_color; //First create each Field Name // Config color filling each Field Name box [b]$pdf->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]);[/b] //// Line 550 ///// //Bold Font for Field Name $pdf->SetFont(PDF_INV_CORE_FONT,'B',10); $pdf->SetY($Y_Fields_Name_position); $pdf->SetX(6); $pdf->Cell(9,6,tep_html_entity_decode(PDF_INV_QTY_CELL),1,0,'C',1); $pdf->SetX(15); $pdf->Cell(27,6,tep_html_entity_decode(TABLE_HEADING_PRODUCTS_MODEL),1,0,'C',1); $pdf->SetX(40); $pdf->Cell(78,6,tep_html_entity_decode(TABLE_HEADING_PRODUCTS),1,0,'C',1); $pdf->SetX(118); $pdf->Cell(20,6,tep_html_entity_decode(TABLE_HEADING_PRICE_EXCLUDING_TAX),1,0,'C',1); $pdf->SetX(138); $pdf->Cell(20,6,tep_html_entity_decode(TABLE_HEADING_PRICE_INCLUDING_TAX),1,0,'C',1); $pdf->SetX(158); $pdf->Cell(20,6,tep_html_entity_decode(TABLE_HEADING_TOTAL_EXCLUDING_TAX),1,0,'C',1); $pdf->SetX(178); $pdf->Cell(20,6,tep_html_entity_decode(TABLE_HEADING_TOTAL_INCLUDING_TAX),1,0,'C',1); $pdf->Ln(); }
  7. I am importing email addresses from OSCommerce and I was wondering if PHPList can handle single quotes in email addresses? For example: O'[email protected] At the moment I don't import addresses with single quotes as the import script shows an error if so , but if I allow this will it cause any problems? Would I have to add slashes to the address? would phplist remove slashes as standard if this was done? or can phplist cope with email address with single quotes without any modification to the email string? Regards, Gareth
  8. Can some explain how the tier system works? particularity the fields: affiliate_lft affiliate_rgt affiliate_root... We have a client who was referred from a friend but they are not getting any credit from it so I need to manually change these fields to link the afficates but I don't understand how the affiliate_lft & affiliate_rgt fields work! Please help... thanks
  9. How can you manually change the affiliate linked to another affiliate using the two tier system. I would like to change it manually in the database so that it links one affiliate as sub affiliate from another. After looking at the tables I am not sure exactly how it works and which columns to change.
  10. Anyone got this working with paypal ipn? If not I will be having a go over the next few days.. any help, experience sample code so on would be appreciated, thanks. I have also got this partly working for attributes using the stock control system to link a vendor to the attribute. This is useful for products where you stock popular versions of a product, but need to drop ship all other versions. My version does not need separate shipping modules so that part is missing.
  11. Has anyone got Multi vendor contribution working for PayPal IPN? Is there any code available to do this? I assume all the changes made to checkout success need to be made to the paypal process functions. If anyone has any experience with this please let me know and help if you can. I have to adapt the PayPal IPN code for Multi vendor if its not been done before.
  12. Further information so someone can help! please! Response Reason Code Tool Please type in the Response Reason Code that you are receiving from the Authorize.Net Payment Gateway: Response Reason Code: 26 Response Reason Text: An error occurred during processing. Please try again in 5 minutes.
  13. We are still getting these errors, some customers take 10 attempts to process their card while others have no problem !
  14. We get a lot of emails from customers saying "I enter my credit card and payment info, click confirm and it takes me back to the same page and has me enter it again over and over and over." Many orders are getting through though but some are failing! Hi, I am trying to make order paying with VISA card (this would be my second purchase from you), however when I enter credit card details and click to confirm order, it redirects me back to payment page giving following error: \" There was an error processing your credit card (26): An error occurred during processing. Please try again. Please check the credit card information you provided is correct.\" This type of error is relatively new and there seems to be an increase in them this week! We are using: Authorize.net Consolidated v1.7 by Austin519 - Payment Zone patch by DjZoNe Many thank in advance.
  15. Has anyone else got this working with PHP 5.. I have just tried it with safe_mode off and its still not working .... I have had to bypass the code that works out which files are on the server and used count (glob()) to limit the number of times it loops to find all the product images. $num_of_images = count (glob($image_base_lg . '*.jpg')); $number_of_images_thumb = count (glob($image_base_lg . '*.thumb*')); /// I have thumps resized that are counted! hence count the ones with thumb. $number_of_images = $num_of_images - $number_of_images_thumb; while ($image_ext = mopics_file_exists(DIR_FS_CATALOG . str_replace($search, $replace, DYNAMIC_MOPICS_PATTERN)) AND $row < $number_of_images) {
×
×
  • Create New...