Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

  • 4 weeks later...

Put all of the products you want to ship for free in one "Vendor" and install a free shipping module for that Vendor. Unless I misunderstand what you wanted, in which case please explain.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Just installed the latest version of MVS and have a quick question: Is the 'vendors' link in the right place (see pic)? It is in the left column the way the usage file says it should be but I'm wondering if it shouldn't be actually contained in the menu rather than riding up above it like that? Thanks.

 

post-323813-0-47518500-1381140484_thumb.jpg

Link to comment
Share on other sites

That's what I thought too, but all the files and edits are there. The problem seems to be with the new files that go in admin and admin\includes\boxes (vendors, etc), which don't have the same style of coding as the files that came with osc 2.3.3. So far I've fixed the MVS issued vendors.php in admin\includes\boxes by editing and renaming the tools.php file in the same folder:

 

MVS 1.2 vendors.php - gives result in pic on previous post:

 

<?php
/*
$Id: vendors.php,v 1.21 2003/07/09 01:18:53 hpdl Exp $
$Loc: /catalog/admin/includes/boxes/ $
$Mod: MVS V1.2 2009/02/28 JCK/CWG $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Released under the GNU General Public License
*/
?>
<!-- vendors //-->
	 <tr>
	 <td>
<?php
$heading = array();
$contents = array();
$heading[] = array('text' => BOX_HEADING_VENDORS,
				 'link' => tep_href_link(FILENAME_VENDORS, 'selected_box=vendors'));
if ($selected_box == 'vendors') {
$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_VENDORS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_VENDORS . '</a><br>' .
							 '<a href="' . tep_href_link(FILENAME_PRODS_VENDORS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_VENDORS_REPORTS_PROD . '</a><br>' .
							 '<a href="' . tep_href_link(FILENAME_ORDERS_VENDORS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_VENDORS_ORDERS . '</a><br>' .
							 '<a href="' . tep_href_link(FILENAME_MOVE_VENDORS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_MOVE_VENDOR_PRODS . '</a>');
}
$box = new box;
echo $box->menuBox($heading, $contents);
?>
	 </td>
	 </tr>
<!-- catalog_eof //-->

 

Fixed vendors.php based on osc2.3.3 tools.php:

<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
$cl_box_groups[] = array(
'heading' => BOX_HEADING_VENDORS,
'apps' => array(
 array(
 'code' => FILENAME_VENDORS,
 'title' => BOX_VENDORS,
 'link' => tep_href_link(FILENAME_VENDORS)
 ),
 array(
 'code' => FILENAME_PRODS_VENDORS,
 'title' => BOX_VENDORS_REPORTS_PROD,
 'link' => tep_href_link(FILENAME_PRODS_VENDORS)
 ),
 array(
 'code' => FILENAME_ORDERS_VENDORS,
 'title' => BOX_VENDORS_ORDERS,
 'link' => tep_href_link(FILENAME_ORDERS_VENDORS)
 ),
 array(
 'code' => FILENAME_MOVE_VENDORS,
 'title' => BOX_MOVE_VENDOR_PRODS,
 'link' => tep_href_link(FILENAME_MOVE_VENDORS)
 )
)
);
?>

 

This gives this result: :)

 

post-323813-0-50030900-1381270884_thumb.jpg

 

Now I need to fix the other files the links call because clicking them now causes this:

 

post-323813-0-59149600-1381271115_thumb.jpg

Link to comment
Share on other sites

  • 1 month later...

Has anyone successfully modified FedEx Web Services v9 to work with MVS? I tried, using the instructions supplied in the modules.txt file, but it's not returning quotes. I'd use the Fedex1 module included with MVS (which does work), but I need the ability to select services and add % handling charges for different vendors that the webservices module gives.

 

I did run into some trouble where the instructions say to modify this line:

 

'cost' => $shipping + MODULE_SHIPPING_change to fedex module_HANDLING)))

 

to

 

'cost' => $shipping + $handling)));

 

because the first line doesn't exist in the webservices module, but otherwise the instructions were fairly easy to apply.

 

The unmodified webservices module does work with MVS off (cart version 2.3.3), so it's not an issue with the fedex credentials being rejected.

 

Attaching the file I modified in case anyone can spot where it went wrong.

fedexwebservices.php

Link to comment
Share on other sites

For the handling charge, try this -- after this line:

 

	    $cost = (float)round(preg_replace('/[^0-9.]/', '',  $cost), 2);

 

add this line:

 

	    $cost = $cost + $handling;

 

For your other problems, I see a couple of constants that have not been converted (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE, MODULE_SHIPPING_FEDEX_WEB_SERVICES_DROPOFF). You need to find all of those and add the $vendors_id to them. If it still doesn't work, you'll just have to debug the module. This is a complex module that will take a lot of work to modify properly.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I usually just throw in print and print_r() statements to take a look at the variables I'm interested in. You sometimes have to use die() to get the code to stop after printing.

 

In this case, I would probably print out $cost and $handling around the code I posted above, and then follow those back once I find out what's not getting set.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 3 weeks later...

Dear osCommerce Forum

 

I've installed the Multi Vendor Shipping (http://addons.oscommerce.com/info/4129 , Version 1.2.3) to my shop. Now I will include a shipping modul which i used before. But with the MVS it need to be converted.

 

I've done the code modifications like described in "modues.txt" file but got these errors when attempting to install the Module in the admin vendor panel:

 

Warning: Missing argument 1 for chpp::chpp(), called in E:\xampplite\htdocs\shop\admin\vendor_modules.php on line 130 and defined in E:\xampplite\htdocs\shop\includes\modules\vendors_shipping\chpp.php on line 46
Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_CHPP_HANDLING1 in E:\xampplite\htdocs\shop\includes\modules\vendors_shipping\chpp.php on line 325
Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_CHPP_TAX_CLASS1 in E:\xampplite\htdocs\shop\includes\modules\vendors_shipping\chpp.php on line 325
Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_CHPP_ZONE1 in E:\xampplite\htdocs\shop\includes\modules\vendors_shipping\chpp.php on line 325
Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_CHPP_SORT_ORDER1 in E:\xampplite\htdocs\shop\includes\modules\vendors_shipping\chpp.php on line 325

 

 

Is there someone who is familiar with this Mod and can go throw the code and give me a hint? I'm not really good in coding, therefore i would be happy for every hint!

 

 

I Attache the Shipping Method Code (chpp.php) after my modifications. Also the instructions text (modules.txt)how to change the code for MVS.

 

Best regards

luke

Link to comment
Share on other sites

You missed the underscore before the $vendors_id in several places, so (for example)

 

  if (defined (@[member='constant'] ('MODULE_SHIPPING_CHPP_SORT_ORDER' . $vendors_id))) {

 

should be

 

  if (defined (@[member='constant'] ('MODULE_SHIPPING_CHPP_SORT_ORDER_' . $vendors_id))) {

 

Of course you could just leave that out, but you would need to do that everywhere.

 

There are also several values in the install() method where you have missed adding the $vendors_id to the configuration_key name. Also, the keys are just strings, not the constant value, so remove the constant() commands from that method.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hello, I installed MVS in OScommerce 2.3.3 all is working but I have this warning:

checkout_payment.php

Warning: strpos() expects parameter 1 to be string, array given in /membri/enoprova/includes/classes/shipping.php on line 25

 

Warning: substr() expects parameter 1 to be string, array given in /membri/enoprova/includes/classes/shipping.php on line 25

 

checkout_confirmation.php

Warning: strpos() expects parameter 1 to be string, array given in /membri/enoprova/includes/classes/vendor_shipping.php on line 48

 

Warning: substr() expects parameter 1 to be string, array given in /membri/enoprova/includes/classes/vendor_shipping.php on line 48

 

the problem is only with PHP 5.3 and not with PHP 5.2

Is there someone that can help to solve this problem?

Thanks in advance

Link to comment
Share on other sites

That means that $PHP_SELF is set as an array. That value is set in includes/application_top.php around line 46:

 

// set php_self in the local scope
 $PHP_SELF = (((strlen(ini_get('cgi.fix_pathinfo')) > 0) && ((bool)ini_get('cgi.fix_pathinfo') == false)) || !isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) ? basename($HTTP_SERVER_VARS['PHP_SELF']) : basename($HTTP_SERVER_VARS['SCRIPT_NAME']);

 

You have made some change there that is incorrect. MVS doesn't touch that line, so it's something else you've installed. Check your installation of whatever it is that's modified that code, or just change it back.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

You missed the underscore before the $vendors_id in several places, so (for example)

 

 if (defined (@[member='constant'] ('MODULE_SHIPPING_CHPP_SORT_ORDER' . $vendors_id))) {

 

should be

 

 if (defined (@[member='constant'] ('MODULE_SHIPPING_CHPP_SORT_ORDER_' . $vendors_id))) {

 

Of course you could just leave that out, but you would need to do that everywhere.

 

There are also several values in the install() method where you have missed adding the $vendors_id to the configuration_key name. Also, the keys are just strings, not the constant value, so remove the constant() commands from that method.

 

Regards

Jim

 

Thank you VERY much for your fast response, your a little hero!

The Error Messages disapeared. But there ist still a problem (chpp.php): The Shipping Modul Settings aren't aviable when it is installed at the "Vendor Shipping Modules" Page. Further when I check out with some products it says: "Unfortunately it is not possible to dispatch into this country".

 

Through the check out there is another issue at the checkout_confirmation.php page which says: Warning: strpos() expects parameter 1 to be string, array given in E:\xampplite\htdocs\shop.librum\includes\modules\order_total\ot_shipping.php on line 48

And at the checkout_process.php page it says Fatal error: Cannot redeclare class shipping in E:\xampplite\htdocs\shop.librum\includes\classes\shipping.php on line 13

But thats due to other things i have to find out.

 

For the moment im struggeling whith the shipping modul issue. Whith the other shipping modules I have no problems.

Link to comment
Share on other sites

I think that

 

    $countries_table = ('MODULE_SHIPPING_CHPP_COUNTRIES_'. $vendors_id . $j);
...
    $chpp_cost_eco = @[member='constant']('MODULE_SHIPPING_CHPP_COST_ECO_'. $vendors_id . $j);
    $chpp_cost_pri = @[member='constant']('MODULE_SHIPPING_CHPP_COST_PRI_'. $vendors_id . $j);

 

needs to be

 

    $countries_table = ('MODULE_SHIPPING_CHPP_COUNTRIES_' . $j . '_' . $vendors_id);
...
    $chpp_cost_eco = @[member='constant']('MODULE_SHIPPING_CHPP_COST_ECO_' . $j. '_' . $vendors_id);
    $chpp_cost_pri = @[member='constant']('MODULE_SHIPPING_CHPP_COST_PRI_'. $j. '_' . $vendors_id);

 

Also

 

    $keys[count($keys)] = 'MODULE_SHIPPING_CHPP_COUNTRIES_' . $ij . '_' . $vendors_id;
    $keys[count($keys)] = 'MODULE_SHIPPING_CHPP_COST_ECO_'. $i j. '_' . $vendors_id;
    $keys[count($keys)] = 'MODULE_SHIPPING_CHPP_COST_PRI_' . $i j. '_' . $vendors_id;

 

The $vendors_id should always be at the very end of the string. Whatever you do, just make it the same everywhere.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

The first two changes were sucessfull!

 

From the last bit of code

for ($i=1; $i <= $this->num_chpp; $i++) {
    $keys[count($keys)] = 'MODULE_SHIPPING_CHPP_COUNTRIES_'. $ij . '_' . $vendors_id;
    $keys[count($keys)] = 'MODULE_SHIPPING_CHPP_COST_ECO_'. $ij . '_' . $vendors_id;
    $keys[count($keys)] = 'MODULE_SHIPPING_CHPP_COST_PRI_'. $ij . '_' . $vendors_id;
  }

only some blank fields appeared in the admin page, with nothing in it.

Link to comment
Share on other sites

Thanks Jim,

probably I understand the problem.

I installed ULTIMATE SEO URL 5 and this add change

 

includes/application_top.php

// set php_self in the local scope
 $PHP_SELF = (((strlen(ini_get('cgi.fix_pathinfo')) > 0) && ((bool)ini_get('cgi.fix_pathinfo') == false)) || !isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) ? basename($HTTP_SERVER_VARS['PHP_SELF']) : basename($HTTP_SERVER_VARS['SCRIPT_NAME']);

to

 

/**
 * ULTIMATE Seo Urls 5 PRO by FWR Media
 * function to return the base filename
 */
 function usu5_base_filename() {
   // Probably won't get past SCRIPT_NAME unless this is reporting cgi location
   $base = new ArrayIterator( array( 'SCRIPT_NAME', 'PHP_SELF', 'REQUEST_URI', 'ORIG_PATH_INFO', 'HTTP_X_ORIGINAL_URL', 'HTTP_X_REWRITE_URL' ) );
   while ( $base->valid() ) {
  if ( array_key_exists(  $base->current(), $_SERVER ) && !empty(  $_SERVER[$base->current()] ) ) {
    if ( false !== strpos( $_SERVER[$base->current()], '.php' ) ) {
	  preg_match( '@[a-z0-9_]+\.php@i', $_SERVER[$base->current()], $matches );
	  if ( is_array( $matches ) && ( array_key_exists( 0, $matches ) )
							    && ( substr( $matches[0], -4, 4 ) == '.php' )
							    && ( is_readable( $matches[0] ) ) ) {
	    return $matches[0];
	  }
    }
  }
  $base->next();
   }
   // Some odd server set ups return / for SCRIPT_NAME and PHP_SELF when accessed as mysite.com (no index.php) where they usually return /index.php
   if ( ( $_SERVER['SCRIPT_NAME'] == '/' ) || ( $_SERVER['PHP_SELF'] == '/' ) ) {
  return 'index.php';
   }
   // Return the standard RC3 code
   return ( ( ( strlen( ini_get( 'cgi.fix_pathinfo' ) ) > 0) && ( (bool)ini_get( 'cgi.fix_pathinfo' ) == false ) ) || !isset( $_SERVER['SCRIPT_NAME'] ) ) ? basename( $_SERVER['PHP_SELF'] ) : basename( $_SERVER['SCRIPT_NAME'] );
 } // End function
// set php_self in the local scope
 $PHP_SELF = usu5_base_filename();

 

I think this is the problem

 

Anybody installed Multi vendor system and Ultimate seo url 5.

 

Thansk for your help Jim

Edited by marcochiana
Link to comment
Share on other sites

That's the problem. That code should work. I've used USU5 before without a problem.

 

Try asking on the USU5 support thread. Tell them that code is returning an array instead of the string it is supposed to.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Thanks for your replay Jim

I think the problem is not in $PHP_SELF is set as an array but $MODULE

in_array(substr($module['id'], 0, strpos($module['id']

 

I try this solution

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

 

 

 if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) {

change to

   if ( (is_string($module) && (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules))) ) {

 

and for

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

 

  if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $modules_array)) ) {

change to

  if ( (is_string($module) && (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $modules_array))) ) {

 

Now is working but i'm not sure I found the solution in a previous post in this topic

Warning: strpos() expects parameter 1 to be string, array given in C:\xampp\htdocs\storelive\includes\classes\vendor_shipping.php on line 46

 

Warning: substr() expects parameter 1 to be string, array given in C:\xampp\htdocs\storelive\includes\classes\vendor_shipping.php on line 46

if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $modules_array)) ) {

 

change it to

if ( (is_string($module) && (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $modules_array))) ) {

 

and it is causing ot_shipping to through the same errors as well

$module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));

so change it to

 

$module = is_string($GLOBALS) && (substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_')));

 

hope this helps

Al

 

but your replay

It's been quite a while, but I think I remember this one. If I'm right, you're missing the code that deals with arrays being passes to the module. Now if I can just remember where that code is....

 

Regards

Jim

Link to comment
Share on other sites

I don't think that solution will work. The first check is_string($module) will always be false, as $module is an array if it has been set. That means the if() will always fail.

 

I don't see the point of the change anyway. For the error you are seeing, either $module['id'] or $PHP_SELF is an array. The correct approach is to add some temporary print statements just before that code:

 

print_r($module['id']);
print_r($PHP_SELF);

 

Then view that page. Once you know which one is an array when it shouldn't be, trace that back to where it is being set.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...