Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

Check that your copy of prods_by_vendor.php has the following line in the header:

  $Mod: MVS V1.2 2009/02/28 JCK/CWG $

If not, update to the latest version.

 

Regards

Jim

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

Link to comment
Share on other sites

Check that your copy of prods_by_vendor.php has the following line in the header:

  $Mod: MVS V1.2 2009/02/28 JCK/CWG $

If not, update to the latest version.

 

Regards

Jim

 

Jim,

 

I believe I have the right version:

 

$Mod: MVS V1.2 2009/02/28 JCK/CWG $

 

I'm not sure what to do next...

 

Henry

Edited by hfs3
Link to comment
Share on other sites

OK, just in case there's something wrong with that file, here's the entire file. This works on my test site:

<?php
/*
 $ID: prods_by_vendor.php (for use with MVS) by Craig Garrison Sr, BluCollar Sales
 $Loc: /catalog/admin/ $
 $Mod: MVS V1.2 2009/02/28 JCK/CWG $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 Released under the GNU General Public License
*/

 require_once ('includes/application_top.php');

 require_once (DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

 // Test changes 01-19-2008
 $line_filter = '';
 if (isset ($_GET['line']) && $_GET['line'] != '') {
   $line_filter = $_GET['line'];
   $line_filter = preg_replace("(\r\n|\n|\r)", '', $line_filter); // Remove CR &/ LF
   $line_filter = preg_replace("/[^a-z]/i", '', $line_filter); // strip anything we don't want
 }

 $vendors_id = 1;
 if (isset ($_GET['vendors_id']) && $_GET['vendors_id'] != '') {
   $vendors_id = (int) $_GET['vendors_id'];
 }

 $show_order = '';
 if (isset ($_GET['show_order']) && $_GET['show_order'] != '') {
   $show_order = $_GET['show_order'];
   $show_order = preg_replace("(\r\n|\n|\r)", '', $show_order); // Remove CR &/ LF
   $show_order = preg_replace("/[^a-z]/i", '', $show_order); // strip anything we don't want
 }

 switch ($line_filter) {
   case 'prod' :
     $sort_by_filter = 'pd.products_name';
     break;
   case 'vpid' :
     $sort_by_filter = 'p.vendors_prod_id';
     break;
   case 'pid' :
     $sort_by_filter = 'p.products_id';
     break;
   case 'qty' :
     $sort_by_filter = 'p.products_quantity';
     break;
   case 'vprice' :
     $sort_by_filter = 'p.vendors_product_price';
     break;
   case 'price' :
   case '' :
   default :
     $sort_by_filter = 'p.products_price';
     break;
 }

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require_once(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require_once(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
       </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
<?php

 $vendors_query = tep_db_query ("select vendors_id, 
                                        vendors_name 
                                 from " . TABLE_VENDORS . " 
                                 order by vendors_name
                               ");
 while ($vendors = tep_db_fetch_array ($vendors_query) ) {
   $vendors_array[] = array (
     'id' => $vendors['vendors_id'],
     'text' => $vendors['vendors_name']
   );
 }
?>
               <td class="main" align="left"><?php echo TABLE_HEADING_VENDOR_CHOOSE . ' '; ?><?php echo tep_draw_form ('vendors_report', FILENAME_PRODS_VENDORS, '', 'get') . tep_draw_pull_down_menu ('vendors_id', $vendors_array,'','onChange="this.form.submit()";');?></form></td>
               <td class="main" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_VENDORS) . '"><b>Go To Vendors List</a>';?><td>
             </tr>
             <tr>
               <td class="main" align="left">
<?php

 if ($show_order == 'desc') {
   // Test code -- 3 lines
   echo 'Click for <a href="' . tep_href_link (FILENAME_PRODS_VENDORS, '&vendors_id=' . $vendors_id . '&line=' . $line_filter . '&show_order=asc') . '"><b>ascending order</b></a>';
 } else {
   echo 'Click for <a href="' . tep_href_link (FILENAME_PRODS_VENDORS, '&vendors_id=' . $vendors_id . '&line=' . $line_filter . '&show_order=desc') . '"><b>descending order</b></a>';
 }
?>
             </td>
           </tr>
       </table></td>
     </tr>
<?php

 if (isset ($vendors_id)) {

   // $vendors_id = $HTTP_POST_VARS['vendors_id'];
   $vend_query_raw = "select vendors_name as name from " . TABLE_VENDORS . " where vendors_id = '" . $vendors_id . "'";
   $vend_query = tep_db_query ($vend_query_raw);
   $vendors = tep_db_fetch_array ($vend_query);
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="1">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_VENDOR; ?></td>
               <td class="dataTableHeadingContent" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_PRODS_VENDORS, 'vendors_id=' . $vendors_id . '&line=prod') . '">' . TABLE_HEADING_PRODUCTS_NAME . '</a>'; ?> </td>
               <td class="dataTableHeadingContent" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_PRODS_VENDORS, 'vendors_id=' . $vendors_id . '&line=vpid') . '">' . TABLE_HEADING_VENDORS_PRODUCT_ID . '</a>'; ?></td>
               <td class="dataTableHeadingContent" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_PRODS_VENDORS, 'vendors_id=' . $vendors_id . '&line=pid') . '">' .  TABLE_HEADING_PRODUCTS_ID . '</a>'; ?></td>
               <td class="dataTableHeadingContent" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_PRODS_VENDORS, 'vendors_id=' . $vendors_id . '&line=qty') . '">' .  TABLE_HEADING_QUANTITY . '</a>'; ?></td>
               <td class="dataTableHeadingContent" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_PRODS_VENDORS, 'vendors_id=' . $vendors_id . '&line=vprice') . '">' .  TABLE_HEADING_VENDOR_PRICE . '</a>'; ?></td>
               <td class="dataTableHeadingContent" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_PRODS_VENDORS, 'vendors_id=' . $vendors_id . '&line=price') . '">' .  TABLE_HEADING_PRICE . '</a>'; ?></td>
             </tr>
             <tr class="dataTableRow">
               <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_VENDORS, '&vendors_id=' . $vendors_id . '&action=edit') . '" TARGET="_blank"><b>' . $vendors['name'] . '</a></b>'; ?></td>
               <td class="dataTableContent"><?php echo ''; ?></td>
               <td class="dataTableContent"><?php echo ''; ?></td>
               <td class="dataTableContent"><?php echo ''; ?></td>
               <td class="dataTableContent"><?php echo ''; ?></td>
               <td class="dataTableContent"><?php echo ''; ?></td>
               <td class="dataTableContent"><?php echo ''; ?></td>

<?php

   // if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] > 1)) $rows = $HTTP_GET_VARS['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;
   $rows = 0;
   if ($show_order == 'desc') {
     $products_query_raw = "select p.products_id, p.vendors_id, pd.products_name, p.products_quantity , p.products_price, p.vendors_product_price, p.vendors_prod_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.vendors_id = " . $vendors_id . " and pd.language_id = " . $languages_id . " order by " . $sort_by_filter . " desc";
   } elseif ($show_order == 'asc') {
     $products_query_raw = "select p.products_id, p.vendors_id, pd.products_name, p.products_quantity , p.products_price, p.vendors_product_price, p.vendors_prod_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.vendors_id = " . $vendors_id . " and pd.language_id = " . $languages_id . " order by " . $sort_by_filter . " asc";
   } else {
     $products_query_raw = "select p.products_id, p.vendors_id, pd.products_name, p.products_quantity , p.products_price, p.vendors_product_price, p.vendors_prod_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.vendors_id = " . $vendors_id . " and pd.language_id = " . $languages_id . " order by " . $sort_by_filter . "";
   }
   /*  $products_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);
     Decide not to use SPLIT pages for the $vendors_id variable not being maintained.
     */

   $products_query = tep_db_query ($products_query_raw);
   while ($products = tep_db_fetch_array ($products_query)) {
     $rows++;

     if (strlen ($rows) < 2) {
       $rows = '0' . $rows;
     }
?>
             <tr class="dataTableRow">
<?php

     if ($products['vendors_prod_id'] == '') {
       $products['vendors_prod_id'] = 'None Specified';
     }
?>
               <td class="dataTableContent"><?php echo ''; ?></td>
               <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=new_product&pID=' . $products['products_id']) . '" TARGET="_blank"><b>' . $products['products_name'] . '</a></b>'; ?></td>
               <td class="dataTableContent"><?php echo $products['vendors_prod_id']; ?></td>
               <td class="dataTableContent"><?php echo $products['products_id']; ?></td>
               <td class="dataTableContent" align="left"><?php echo $products['products_quantity']; ?> </td>
               <td class="dataTableContent"><?php echo $products['vendors_product_price']; ?></td>
               <td class="dataTableContent"><?php echo $products['products_price']; ?></td>
             </tr>
<?php

   }
 }
?>
           </table></td>
         </tr>
         <tr>
           <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="smallText" valign="top">
<?php

 //   echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS);
?>
               </td>
               <td class="smallText" align="right">
<?php

 //   echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'].$vendors_id);
?>
               </td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require_once(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require_once(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Regards

Jim

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

Link to comment
Share on other sites

OK, just in case there's something wrong with that file, here's the entire file. This works on my test site:

<?php

/*

$ID: prods_by_vendor.php (for use with MVS) by Craig Garrison Sr, BluCollar Sales

$Loc: /catalog/admin/ $

$Mod: MVS V1.2 2009/02/28 JCK/CWG $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2006 osCommerce

 

Released under the GNU General Public License

 

Jim,

 

That did the trick. Thank you so much! One down, one to go. Perhaps I should try the same thing with checkout_shipping.php?

 

Henry

Link to comment
Share on other sites

I doubt that your problem is in checkout_shipping.php, unless you made an error applying the MVS code. The front-end code has been stable and working for years now.

 

Regards

Jim

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

Link to comment
Share on other sites

I doubt that your problem is in checkout_shipping.php, unless you made an error applying the MVS code. The front-end code has been stable and working for years now.

 

Regards

Jim

 

Jim,

 

I agree with you. I ran the mvs.sql code (copy/paste to command line in mySQL 4.1.14). Is there a better way, or should I re-run?

 

Henry

Link to comment
Share on other sites

No, that should be fine. Rerunning it will cause duplicate entries, which is a problem. You could check your database to see if the entries are there. If they are, start looking for errors in your PHP files.

 

Regards

Jim

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

Link to comment
Share on other sites

No, that should be fine. Rerunning it will cause duplicate entries, which is a problem. You could check your database to see if the entries are there. If they are, start looking for errors in your PHP files.

 

Regards

Jim

 

Jim,

 

That sounds reasonable, except I really don't know where to start! The ship estimator works just fine without vendor shipping enabled...

 

Henry

Link to comment
Share on other sites

As a general rule, start with the database. If everything is there, the problem is on the catalog side. If it's not, look on the Admin side. You appear to be having problems in the Catalog, so start looking through those files for errors. Use a file comparison program to compare the ones in the MVS download with yours. Pay particular attention to the sections enclosed by MVS tags. If you find something that doesn't look right and you can't figure it out, post a snippit here. Please don't post entire files.

 

Regards

Jim

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

Link to comment
Share on other sites

As a general rule, start with the database. If everything is there, the problem is on the catalog side. If it's not, look on the Admin side. You appear to be having problems in the Catalog, so start looking through those files for errors. Use a file comparison program to compare the ones in the MVS download with yours. Pay particular attention to the sections enclosed by MVS tags. If you find something that doesn't look right and you can't figure it out, post a snippit here. Please don't post entire files.

 

Regards

Jim

 

Jim,

 

Thanks for the pointers! I'll keep you posted. ;)

 

Henry

Link to comment
Share on other sites

Please help.

 

In orders per Vendor when I change this section to reflect the vendor IS it works 100%

 

$vendors_id = 4;

if (isset ($_GET['vendors_id'])) {

$vendors_id = (int) $_GET['vendors_id'];

}

 

Is there any way to make this $vendors_id = 1, 2, 3, 4 etc; in order for me to display all vendor orders?

Link to comment
Share on other sites

I just installed MVS 1.1. I am also using STS4 and when I press the shipping estimator button, I get my STS template with $contents on it. Do I need a separate template for the shipping estimator? Or have I got something wrong on the setup? I have been through it twice and can't find anything.

 

Thanks in advance

 

Steve

Link to comment
Share on other sites

Yes, you need to make some modifications to make the estimator popup work with STS. It should be the same as the other popups. I can't help with this since I don't use STS. The STS support thread would probably be the best place to ask.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi Jim, no the URL didn't change. Nothing happened and nothing was displayed. Thus I started to modify...

 

What I also did in the mean time was I built a vendor admin section where the vendor can only add and view his products and also orders. I removedthe drop down and forced the vendor ID.

 

Now I need to fix my view and I was hoping to use the same force method?

Link to comment
Share on other sites

The pulldown uses Javascript to trigger a refresh. Do you have Javascript disabled? You could always do this with a form and a standard Submit button if you don't want to use the Javascript method.

 

Regards

Jim

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

Link to comment
Share on other sites

Yes, that's a problem with the Javascript submit. There's no way to pass the other variables, so they all get reset. A standard form should fix this.

 

Regards

Jim

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

Link to comment
Share on other sites

Hello Jim - thanks for pointing me in the right direction. There's not a lot on the STS board about it - but I did figure it out from what they had. Figured I would post it here to help everyone.

 

Basically you have to create an exception from your templates to get the popup to work correctly. In order to do that you have to go into

 

includes\modules\sts\sts_default.php

 

and find (it was on line 43 in my file):

 

if (strstr($scriptbasename, "popup")|| strstr($scriptbasename, "info_shopping_cart"))

return ''; // We don't use template for these scripts

 

Insert code as shown using the name of file you want to exclude from your template:

 

if (strstr($scriptbasename, "popup")|| strstr($scriptbasename, "file_to_exlude.php") || strstr($scriptbasename, "info_shopping_cart"))

return ''; // We don't use template for these scripts

 

So to remove the template styles from the shipping estimator popup I changed the code to:

 

if (strstr($scriptbasename, "popup")|| strstr($scriptbasename, "products_ship_estimator.php") || strstr($scriptbasename, "info_shopping_cart"))

return ''; // We don't use template for these scripts

 

Hope this helps others figure it out if they have the same problem.

Link to comment
Share on other sites

Hi Jim, any idea of how to configure the edit_order module with this contrib?

 

I've got a very nice working version of this one installed and tried to incorporate the vendor ID in the add product section however the vendor mails still don't go out.

When a order comes in normally and I use the editor to update the status the mail does go out it's just when I create an order when it's not working.

http://www.oscommerce.com/community/contributions,1435

 

Any ideas?

Link to comment
Share on other sites

Sorry, I haven't used that Addon at all. You might check to see if it updates the orders_status field in the orders table. That might give you a hint of where to look.

 

Regards

Jim

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

Link to comment
Share on other sites

Yes the order status is updated.

 

When I edit an order created by a customer in the order editor the vendor mail does go out but when I create an order using the order editor on the admin side and then change the status nothing goes out .. guess when adding a product the vendor id and mail sent status isn't updated.

 

I'll play and see what i can do, Thanks!

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...