marcochiana Posted December 17, 2013 Share Posted December 17, 2013 Hello, I post the solution for the error in checkout_payment.php Warning: strpos() expects parameter 1 to be string, array given in C:\xampp\htdocs\enodreams\includes\classes\shipping.php on line 28 Warning: substr() expects parameter 1 to be string, array given in C:\xampp\htdocs\enodreams\includes\classes\shipping.php on line 28 I commented these lines /* CCGV - BEGIN ## OPTIONAL! ## */ //require(DIR_WS_CLASSES . 'shipping.php'); //$shipping_modules = new shipping($shipping); /* CCGV - END ## OPTIONAL! ## */ For the error in checkout_confirmation Warning: strpos() expects parameter 1 to be string, array given in C:\xampp\htdocs\enodreams\includes\classes\vendor_shipping.php on line 48 Warning: substr() expects parameter 1 to be string, array given in C:\xampp\htdocs\enodreams\includes\classes\vendor_shipping.php on line 48 I commented these lines //MVS start /* if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true') ) { include_once (DIR_WS_CLASSES . 'vendor_shipping.php'); } elseif ( ($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'false') ) { include_once (DIR_WS_CLASSES . 'shipping.php'); } */ //MVS End I don't know i'm the only one with this problem in oscommerce 2.3.3 PHP 5.3 (in php 5.2 not show the warning) thanks jim for your help and time Marco Quote Link to comment Share on other sites More sharing options...
♥kymation Posted December 17, 2013 Share Posted December 17, 2013 That first block of code seems to be part of the CCGV addon. I'm not certain of the effect on that addon of removing a part of the code, but I expect it will break something. The second block of code calls the appropriate shipping class. Removing that will break the shipping part of the checkout completely. I suggest that you reverse those changes and go find out what the problem really is. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
marcochiana Posted December 17, 2013 Share Posted December 17, 2013 Thanks for the replay, for the CCGV addons these lines are optional and at the moment I don't use this addons. for the second block i think you are right but i found this solution in the web probably the problem of $module set as Array is in checkout_shipping.php in this part // MVS Start if (SELECT_VENDOR_SHIPPING == 'true') { $total_shipping_cost = 0; $shipping_title = MULTIPLE_SHIP_METHODS_TITLE; $vendor_shipping = $cart->vendor_shipping; $shipping = array(); foreach ($vendor_shipping as $vendor_id => $vendor_data) { $products_shipped = $_POST['products_' . $vendor_id]; $products_array = explode ("_", $products_shipped); $shipping_data = $_POST['shipping_' . $vendor_id]; $shipping_array = explode ("_", $shipping_data); $module = $shipping_array[0]; $method = $shipping_array[1]; $ship_tax = $shipping_array[2]; if ( is_object($$module) || ($module == 'free') ) { if ($module == 'free') { $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE; $quote[0]['methods'][0]['cost'] = '0'; } else { $total_weight = $vendor_shipping[$vendor_id]['weight']; $shipping_weight = $total_weight; $cost = $vendor_shipping[$vendor_id]['cost']; $total_count = $vendor_shipping[$vendor_id]['qty']; $quote = $shipping_modules->quote($method, $module, $vendor_id); } if (isset($quote['error'])) { tep_session_unregister('shipping'); } else { if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) { $output[$vendor_id] = array('id' => $module . '_' . $method, 'title' => $quote[0]['methods'][0]['title'], 'ship_tax' => $ship_tax, 'products' => $products_array, 'cost' => $quote[0]['methods'][0]['cost'] ); $total_ship_tax += $ship_tax; $total_shipping_cost += $quote[0]['methods'][0]['cost']; }//if isset }//if isset }//if is_object }//foreach if ($free_shipping == true) { $shipping_title = $quote[0]['module']; } elseif (count($output) <2) { $shipping_title = $quote[0]['methods'][0]['title']; } $shipping = array('id' => $shipping, 'title' => $shipping_title, 'cost' => $total_shipping_cost, 'shipping_tax_total' => $total_ship_tax, 'vendor' => $output ); tep_redirect (tep_href_link (FILENAME_CHECKOUT_PAYMENT, '', 'SSL') ); } else { // MVS End but i'm not able to find a right solution :-( Quote Link to comment Share on other sites More sharing options...
bekatron Posted December 29, 2013 Share Posted December 29, 2013 i try to install mvs to a clean oscommerce 2.3.3.4. the shop is on xampp apache 2.4.3 and php5.4.7 but only get a lot of faults when i try to install this. Where can i find the latest install for this or is it all a little buggy for this version? I have made most of the translation to Dutch so if this version is on the add page i can add it. Bas Quote Link to comment Share on other sites More sharing options...
♥kymation Posted December 29, 2013 Share Posted December 29, 2013 Remember that MVS was written for osCommerce 2.2x, so you will have to update all of the files by hand. I can help with individual errors if you post them here. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
surknight Posted December 30, 2013 Share Posted December 30, 2013 Need a little help with a preg_replace error. I'm getting this error when I try installing the MVS version of the USPS module provided with MVS: Warning: preg_replace(): No ending delimiter ',' found in C:\xampp\htdocs\catalog\admin\vendor_modules.php on line 27 This is line 27 of that file: $value = preg_replace (", --none--", "", $value); Any help would be appreciated. I've read the PHP documentation on preg statements and can't quite see the problem. Quote Link to comment Share on other sites More sharing options...
♥kymation Posted December 30, 2013 Share Posted December 30, 2013 The delimiters are missing, so PHP is taking the starting comma as a delimiter. That line should use str_replace anyway. Try this: $value = str_replace( ', --none--', '', $value ); Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
marcochiana Posted December 30, 2013 Share Posted December 30, 2013 Hello thanks for you previous help, now i have another problem in checkout_process.php don't save vendors ID in TABLE ORDERS PRODUCTS this is the code // 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']) . "'"); //MVS - added 'vendors_id' => ... print_r($order->products[$i]); die(); $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'], 'vendors_id' => $order->products[$i]['vendors_id'] ); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = tep_db_insert_id(); and this is the result of the array Array ( [qty] => 1 [name] => Canneto - Calamus IGT Toscana Bianco 2011 [model] => [tax] => 0 [tax_description] => Tassa sconosciuta [price] => 8.4700 [final_price] => 8.47 [vendors_id] => [vendors_name] => [weight] => 1.00 [id] => 197 ) Any help is appreciate Best regards Quote Link to comment Share on other sites More sharing options...
♥kymation Posted December 30, 2013 Share Posted December 30, 2013 The values are not being set in the orders class. Check the changes in includes/classes/orders.php. Also check the preceding pages. Does this happen with new customers, with old customers who are just logging in, or with both? Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
marcochiana Posted December 30, 2013 Share Posted December 30, 2013 thanks for the replay, the problem is with new and old customers. I put Print_r in classes/order.php $index = 0; $products = $cart->get_products(); print_r($products); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), //MVS start 'vendors_id' => $products[$i]['vendors_id'], 'vendors_name' => $products[$i]['vendors_name'], //MVS end 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']); the result is this Array ( [0] => Array ( [id] => 197 [name] => Canneto - Calamus IGT Toscana Bianco 2011 [model] => [image] => cannetocalamus120x180.png [discount_categories_id] => [price] => 8.4700 [quantity] => 1 [weight] => 1.00 [length] => [width] => [height] => [ready_to_ship] => [final_price] => 8.47 [tax_class_id] => 0 [vendors_id] => [vendors_name] => [attributes] => ) ) I think no value in vendors_id and vendors_name I copied order.php no changes and no error ( I think) Which file can I check to understand the problem? Quote Link to comment Share on other sites More sharing options...
♥kymation Posted December 30, 2013 Share Posted December 30, 2013 The data comes from $cart->get_products(), so the shopping cart class is the next place to look. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
---luke--- Posted December 30, 2013 Share Posted December 30, 2013 There may be other errors that I didn't spot. Check all of your edits again. Sorry I can't be of more help right now. Regards Jim Hi Jim, I didn't managed to fix it therefore I have chosen an existing shipping module. Now its working ok. The system is working fine but one error at the checkout_confirmation.php site: Warning: strpos() expects parameter 1 to be string, array given in catalog\includes\modules\order_total\ot_shipping.php on line 48 I can order the products. The only effect ist that afterwards the order doesn't appear under the Vendors->Vendors Orders List but only in the Customners->Orders list. Do you know where this error could come from? Can you help me one step forward a solution? luke Quote Link to comment Share on other sites More sharing options...
♥kymation Posted December 31, 2013 Share Posted December 31, 2013 I've never seen that before. My guess is that you have made a mistake somewhere in the Admin side of your store, but I don't know where. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
marcochiana Posted December 31, 2013 Share Posted December 31, 2013 Thanks Jim, you are right, the problem is in shopping cart class, I installed QPBPP (quantity price break per product) and this part of MVS //MVS //upsxml dimensions - added p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id, v.vendors_id, v.vendors_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_VENDORS . " v where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and v.vendors_id = p.vendors_id and pd.language_id = '" . (int)$languages_id . "'"); if ($products = tep_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_price = $products['products_price']; $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']; } is now with QPBPP // BOF qpbpp 2.0 $pf->loadProduct($products_id, $languages_id); // does query if necessary and adds to // PriceFormatterStore or gets info from it next if ($products = $pfs->getPriceFormatterData($products_id)) { if (tep_not_null($this->contents[$products_id]['discount_categories_id'])) { $nof_items_in_cart_same_cat = $discount_category_quantity[$this->contents[$products_id]['discount_categories_id']]; $nof_other_items_in_cart_same_cat = $nof_items_in_cart_same_cat - $this->contents[$products_id]['qty']; } else { $nof_other_items_in_cart_same_cat = 0; } $products_price = $pf->computePrice($this->contents[$products_id]['qty'], $nof_other_items_in_cart_same_cat); // EOF qpbpp 2.0 I'll try to find a solution, is there someone that installed QPBPP and MVS in oscommerce 2.3.3 ? Regards Marco Quote Link to comment Share on other sites More sharing options...
marcochiana Posted December 31, 2013 Share Posted December 31, 2013 This is the solution for classes shoppingcart to work QPBPP and MVS in 2.3.3 oscommerce thanks jim for the help function get_products() { // BOF qpbpp 2.0 global $languages_id, $pfs; // EOF qpbpp 2.0 if (!is_array($this->contents)) return false; // BOF qpbpp 2.0 $discount_category_quantity = array(); foreach ($this->contents as $products_id => $contents_array) { if(tep_not_null($contents_array['discount_categories_id'])) { if (!isset($discount_category_quantity[$contents_array['discount_categories_id']])) { $discount_category_quantity[$contents_array['discount_categories_id']] = $contents_array['qty']; } else { $discount_category_quantity[$contents_array['discount_categories_id']] += $contents_array['qty']; } } } // end foreach $pf = new PriceFormatter; // EOF qpbpp 2.0 $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { //MVS //upsxml dimensions - added p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, $products_queryMVS = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_length, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id, v.vendors_id, v.vendors_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_VENDORS . " v where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and v.vendors_id = p.vendors_id and pd.language_id = '" . (int)$languages_id . "'"); if ($productsMVS = tep_db_fetch_array($products_queryMVS)) { $pridMVS = $productsMVS['products_id']; $products_priceMVS = $productsMVS['products_price']; $specials_queryMVS = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$pridMVS . "' and status = '1'"); if (tep_db_num_rows($specials_queryMVS)) { $specialsMVS = tep_db_fetch_array($specials_queryMVS); $products_priceMVS = $specialsMVS['specials_new_products_price']; } }//end if ($productsMVS..... // BOF qpbpp 2.0 $pf->loadProduct($products_id, $languages_id); // does query if necessary and adds to // PriceFormatterStore or gets info from it next if ($products = $pfs->getPriceFormatterData($products_id)) { if (tep_not_null($this->contents[$products_id]['discount_categories_id'])) { $nof_items_in_cart_same_cat = $discount_category_quantity[$this->contents[$products_id]['discount_categories_id']]; $nof_other_items_in_cart_same_cat = $nof_items_in_cart_same_cat - $this->contents[$products_id]['qty']; } else { $nof_other_items_in_cart_same_cat = 0; } $products_price = $pf->computePrice($this->contents[$products_id]['qty'], $nof_other_items_in_cart_same_cat); // EOF qpbpp 2.0 $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], // BOF qpbpp 2.0 'discount_categories_id' => $this->contents[$products_id]['discount_categories_id'], // EOF qpbpp 2.0 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], //upsxml dimensions start 'length' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_length']), 'width' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_width']), 'height' => ($products['product_free_shipping'] == '1' ? 0 : $products['products_height']), //uspxml dimensions end 'final_price' => ($products_price + $this->attributes_price($products_id)), 'tax_class_id' => $products['products_tax_class_id'], //MVS start 'vendors_id' => $productsMVS['vendors_id'], 'vendors_name' => $productsMVS['vendors_name'], //MVS end 'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '')); } } return $products_array; } Quote Link to comment Share on other sites More sharing options...
♥kymation Posted December 31, 2013 Share Posted December 31, 2013 Thanks for sharing that code. I had a different solution, but yours should work as well. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
---luke--- Posted January 2, 2014 Share Posted January 2, 2014 The system is working fine but one error at the checkout_confirmation.php site: Warning: strpos() expects parameter 1 to be string, array given in catalog\includes\modules\order_total\ot_shipping.php on line 48 I can order the products. The only effect ist that afterwards the order doesn't appear under the Vendors->Vendors Orders List but only in the Customners->Orders list. Do you know where this error could come from? Can you help me one step forward a solution? luke I found the problem in an older post: http://www.oscommerce.com/forums/topic/101973-multi-vendor-shipping-new-thread/page__st__4240#entry1554873 Now it is working! Quote Link to comment Share on other sites More sharing options...
marcochiana Posted January 2, 2014 Share Posted January 2, 2014 Hello, I had a problem in product reports and vendors orders list the drop down menu doesn't work I solved in this way in prods_by_vendors.php change if (isset ($_GET['vendors_id']) && $_GET['vendors_id'] != '') { $vendors_id = (int) $_GET['vendors_id']; } TO if (isset ($_POST['vendors_id']) && $_POST['vendors_id'] != '') { $vendors_id = (int) $_POST['vendors_id']; } and in orders_by_vendors.php change $vendors_id = 0; if (isset ($_GET['vendors_id'])) { $vendors_id = (int) $_GET['vendors_id']; } $line_filter = 'desc'; if (isset ($_GET['line']) && $_GET['line'] == 'asc') { $line_filter == $_GET['line']; } $sort_by_filter = 'orders_id'; if (isset ($_GET['by']) && $_GET['by'] != '') { switch ($_GET['by']) { case 'date': $sort_by_filter = 'date_purchased'; break; case 'customer': $sort_by_filter = 'customers_id'; break; case 'status': $sort_by_filter = 'status'; break; case 'sent': $sort_by_filter == 'sent'; break; default: $sort_by_filter = 'orders_id'; break; } } TO $vendors_id = 0; if (isset ($_POST['vendors_id'])) { $vendors_id = (int) $_POST['vendors_id']; } $line_filter = 'desc'; if (isset ($_POST['line']) && $_POST['line'] == 'asc') { $line_filter == $_POST['line']; } $sort_by_filter = 'orders_id'; if (isset ($_POST['by']) && $_POST['by'] != '') { switch ($_POST['by']) { case 'date': $sort_by_filter = 'date_purchased'; break; case 'customer': $sort_by_filter = 'customers_id'; break; case 'status': $sort_by_filter = 'status'; break; case 'sent': $sort_by_filter == 'sent'; break; default: $sort_by_filter = 'orders_id'; break; } } Now I have another problem I can't send the email to vendors. If I try there's always this message "contact" I don't understant the code in Vendor_email_send.php in this part $debug = 'no'; $debug_preview = 'no'; $debug_arrive = 'no'; $debug_sent = 'no'; $vendors_id = $vID; $oID = $oID; $vendor_order_sent = $vOS; if ($debug == 'yes') { echo 'The vendor post data: ' . $vendors_id . ' ' . $oID . ' ' . $vendor_order_sent . '<br>'; } Debug will always NO or I have to see another file php. Any help is appreciate Regards Marco Quote Link to comment Share on other sites More sharing options...
---luke--- Posted January 3, 2014 Share Posted January 3, 2014 (edited) Now I have another problem I can't send the email to vendors. If I try there's always this message "contact" I have the same problem. Tell me if you can fix it! I have an other problem: the "vendors_id" is not being inserted in the "orders_shipping" table. Instead of the ID there is only a "0" in this database table. So the orders wont appeare in the "Orders by Vendor" List. Is this an known issue? I have already searched in the thread but I have only got the hint to look in the chekout_process.php file. I'm trying to fit the MVS in oscommerce 2.3... Best Regard luke Edited January 3, 2014 by ---luke--- Quote Link to comment Share on other sites More sharing options...
marcochiana Posted January 3, 2014 Share Posted January 3, 2014 Hi Luke, If I found the solution about send email i'll post. I'm not expert in php but about your other problem you have to see first in checkout.process.php. Try to use print_r to see the values. regards Quote Link to comment Share on other sites More sharing options...
---luke--- Posted January 3, 2014 Share Posted January 3, 2014 Hi Luke, If I found the solution about send email i'll post. I'm not expert in php but about your other problem you have to see first in checkout.process.php. Try to use print_r to see the values. regards Hi Marco That would be great if you can post your email solution! Im no expert either... So when I use the print_r function the "orders_id" appears but in the database table there is a zero. I don't know whats going wrong here.If I'm right this is the code which performs the writing in the database but it seems theres everything oke: $sql_data_array = array ('orders_id' => $orders_id, 'vendors_id' => $vendors_id, 'shipping_module' => $shipping_method, 'shipping_method' => $shipping_data['title'], 'shipping_cost' => $shipping_data['cost'], 'shipping_tax' => $shipping_data['ship_tax'], 'vendors_name' => $vendors_name, 'vendor_order_sent' => 'no' ); tep_db_perform (TABLE_ORDERS_SHIPPING, $sql_data_array); Regards Luke Quote Link to comment Share on other sites More sharing options...
marcochiana Posted January 3, 2014 Share Posted January 3, 2014 Hi luke, I think this line is wrong $sql_data_array = array ('orders_id' => $orders_id, try this $sql_data_array = array('orders_id' => $insert_id, ---luke--- 1 Quote Link to comment Share on other sites More sharing options...
---luke--- Posted January 3, 2014 Share Posted January 3, 2014 Hi luke, I think this line is wrong $sql_data_array = array ('orders_id' => $orders_id, try this $sql_data_array = array('orders_id' => $insert_id, Perfect - thats the solution! Quote Link to comment Share on other sites More sharing options...
Guest Posted January 7, 2014 Share Posted January 7, 2014 (edited) Hey guys! Great job on the contrib, and glad to see the forum thread is still active. :) I've implemented MVS on a 2.2 site (had to use 2.2 for various reasons) and it's working just fine, but I'm wondering about the case where a product can have mutiple vendors. I'd like to be able to edit the order AFTER the customer has placed it and change the vendor for a particular product for that order. For example, they order the product, but I know that one vendor is cheaper for that product than another. From the customer's perspective, nothing has changed, but from an admin perspective, the email gets sent to a different vendor. All of the shipping is flat rate per "region" (basically US or Canada), so changing it after the fact wouldn't change shipping calculations. I have mulitple vendors set up, but I can only attach one vendor to any given product. I thought that selecting NONE as the vendor might allow me to select later, but it defaults to the local store. Does the functionality exist already and I've missed it? If not, is it planned? I've read through some old (2005) posts on something similar to this in the thread, but haven't seen anything more recent. Any thoughts on this? Thanks! Edited January 7, 2014 by WWDev Quote Link to comment Share on other sites More sharing options...
♥kymation Posted January 7, 2014 Share Posted January 7, 2014 There is no code to connect more than one vendor to a product, and the database configuration would not allow this. That would mean a new database table and a fairly large change to the code. It could be done, but it would not be easy. I don't recommend using osCommerce 2.2 at this time. There are too many problems with that old code, and too great a likelihood that it will stop working the next time your host updates something. It's not that hard to get this working on a 2.3.3.4 install, and the result is much nicer, not to mention more secure. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.