Jump to content
Latest News: (loading..)
drillsar

Multi_Vendor for bootstrap version

Recommended Posts

I am trying to add MVS into the bootstrap version. I am almost their except the part where it actually displays shipping. It displays but the template is a lot different in this version. I was wondering if anyone has done it or at least help me to get this to the bootstrap version. The only page I am struggling at the moment is the checkout_shipping page.

Share this post


Link to post
Share on other sites

Anyone else want to help me with this? Right now the problem is the way it's being displayed in cart. Also the order_by_vendor.php is not showing the orders no big deal though because you get it through manage by vendor but it has to be something stupid on why order_by_vendor.php isnt working. I am sure it's working with 2.3.4 just not with bootstrap as of now. In a day or so I am going to upload it here. Again for test purposes only be prepared for bugs, etc. I am just hoping someone can help me through this great contribution.

Share this post


Link to post
Share on other sites

I don't have the ability to lend you a hand at the moment (non-coder learning to code still) but I did however want you to know that you are not the only one interested in this. 

Share this post


Link to post
Share on other sites

@@drillsar

@@tmccaff
@@dspeak
@@opus_uno2001
@@Peace2u
@@kushol
@—luke—
@@nepm

Begging your pardon if this annoys anyone, I got the impression you are all interested in upgrading Multi Vendor Shipping to a osc 2.3.4 Bootstrap compatible version.

I'm a store owner running MVS (currently 2.2RC2A) for many years now. I'm not a coder, but I am determined.

So far my test install of MVS on BS works pretty well except for the shipping estimators; you can see kymation's reply http://forums.oscommerce.com/topic/101973-multi-vendor-shipping-new-thread/page-246

I'm hoping there is some chance of us working together.

I don't have a test website set up that is accessible to the public but I'm willing to share that and possibly open the code up on github if there's some interest.

Thanks for listening.

~motorcity

Share this post


Link to post
Share on other sites

Let’s take a look at the score. These are the public side files that need to get a good bootstrapping. Please note; all of my testing is being done in PHP 5.2.9 and Mozilla Firefox and Android Chrome. All of these files are being developed in the hope of releasing this as a generic addon to Multi Vendor Shipping so nothing is being changed that differs from osc2.3.4 or Gary's Responsive Bootstrapped Gold version so merging files is as easy as possible.

Anyone who would like to help or just test is welcome.
account_history_info BS ok 4/18 however, if an order has multiple shipments numbers (vendors) that table doesn’t BS well. (Standard osc just calls it combined shipping in the order listing, then offers a separate box called shipping method again saying ‘combined shipping’ but not clickable.)
checkout_confirmation BS looks ok 4/19
checkout_payment BS looks ok 4/19
checkout_process Not sure how to get there to test it.
checkout_shipping Worked over 4/18/15 BS this is close. Needs to work with includes/modules/vendor_shipping.
product_info BS is ok
products_ship_estimator Doesn’t work in BS
ship_estimator Doesn’t work in BS
shopping_cart BS is ok
includes/modules/vendor_shipping This is where checkout_shipping gets it’s selector by product, by vendor, choose the shipping option. It’s been kicking my butt! I’ve had it where if multiple products with different shipping vendors you can’t change the selection like UPS ground or next day, you only get the cheapest UPS. No changing the option on that method. To more recently where the above is solved but, selecting an option on one product deselects the option for a different product. IE you can't select option by product.

 

Anyways, I'll be back at it in the morning.

Here's the module code;

<?php
/*
  $Id: vendor_shipping.php,v 1.0 2005/03/29 kymation Exp $
  $Loc: catalog/includes/modules/
  $Mod: MVS V1.3 20120205 Kymation $

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

  Copyright (c) 2005 osCommerce

  Released under the GNU General Public License
*/

    $vendor_shipping = $cart->vendor_shipping();

//Display a notice if we are shipping by multiple methods
    if (count ($vendor_shipping) > 1) {
?>

  <div  class="alert alert-warning">
    <?php echo TEXT_MULTIPLE_SHIPPING_METHODS; ?>
  </div>

<?php
    }

//Draw a selection box for each shipping_method
    foreach ($vendor_shipping as $vendor_id => $vendor_data) {
      $total_weight = $vendor_data['weight'];
      $shipping_weight = $total_weight;
      $cost = $vendor_data['cost'];
      $ship_tax = $shipping_tax;   //for taxes
      $total_count = $vendor_data['qty'];

//  Much of the code from the top of the main page has been moved here, since
//    it has to be executed for each vendor
      if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
        $pass = false;

        switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
          case 'national':
            if ($order->delivery['country_id'] == STORE_COUNTRY) {
              $pass = true;
            }
            break;
          case 'international':
            if ($order->delivery['country_id'] != STORE_COUNTRY) {
              $pass = true;
            }
            break;
          case 'both':
            $pass = true;
            break;
          }

          $free_shipping = false;
          if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
            $free_shipping = true;

            include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');
          }
        } else {
          $free_shipping = false;
        }
//print "<br>Vendor_id in Shipping: " . $vendor_id;
//Get the quotes array
      $quotes = $shipping_modules->quote('', '', $vendor_id);

// Free shipping start
// See if free.php is amoung them
      for ($i=0, $n=count($quotes); $i<$n; $i++) {
        if ( ( ($quotes[$i]['id']) == 'free' ) && ($order->info['total'] >=  $quotes[$i]['minpurchase']) ){
          $free_shipping = true;
          $minpurchase = $quotes[$i]['minpurchase'];
        }
      }
// Free shipping end

// if no shipping method has been selected, automatically select the cheapest method.
// if the modules status was changed when none were available, to save on implementing
// a javascript force-selection method, also automatically select the cheapest shipping
// method if more than one module is now enabled
    if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest($vendor_id);

?>
  <div class="contentText"><!--top div -->
    <div class="ui-widget-content infoBoxContents">
      <table border="0" width="100%" cellspacing="0" cellpadding="2"><!--top table -->
          <tr><!--same as jims abandoned tr -->
            <td><table border=0 width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td class="main" width="50%" valign="top"><b><?php echo TEXT_PRODUCTS; ?></b></td>
                <td class="main" width="50%" valign="top"> </td>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
<?php
      $products_ids = $vendor_data['products_id'];
      foreach ($products_ids as $product_id) {
        $products_query = tep_db_query("select products_name
			                                  from " . TABLE_PRODUCTS_DESCRIPTION . "
			                                  where products_id = '" . (int)$product_id . "'
			                                    and language_id = '" . (int)$languages_id . "'"
                                      );
        $products = tep_db_fetch_array($products_query);
?>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td class="main" width="50%" valign="top">
<?php
        echo tep_draw_separator('pixel_trans.gif', '10', '1');
        echo $products['products_name'];
?>
                </td>
                <td class="main" width="50%" valign="top" align="right"><?php ; ?></td>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
<?php
      }//foreach
?>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
              </tr>
<?php
      if (count($quotes) > 1) {
?>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></td>
                <td class="main" width="50%" valign="top" align="right"><?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?></td>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
<?php
      } elseif ($free_shipping == false) {
// the following is copied from checkout_shipping ResponsiveBS all free shipping to line 165 4/19/15
?>
<tr>
  <div class="contentText">
    <div class="alert alert-info"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></div>
  </div>

<?php
      }
?>  
<!--  <div class="contentText">
    <table class="table table-striped table-condensed table-hover">
      <tbody> -->
</tr>
<?php
      if ($free_shipping == true) {
?>
<tr>
    <div class="contentText">
      <div class="panel panel-success">
        <div class="panel-heading"><strong><?php echo FREE_SHIPPING_TITLE; ?></strong> <?php echo $quotes[$i]['icon']; ?></div>
        <div class="panel-body">
          <?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?>
        </div>
      </div>
    </div>
	</tr>
<?php //eof copy
?>
<?php
    } else {
      $radio_buttons = 0;
      for ($i=0, $n=count($quotes); $i<$n; $i++) {
?>
              <tr> <!--same as jims -->

                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td colspan="2"><table class="table table-striped table-condensed table-hover">
                  <tr>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                    <td class="main" colspan="3"><b><?php echo $quotes[$i]['module']; ?></b> <?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></td>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                  </tr>
<?php
        if (isset($quotes[$i]['error'])) {
?>
                  <tr>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                    <td class="main" colspan="3"><?php echo $quotes[$i]['error']; ?></td>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                  </tr>
<?php
        } else {
          for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
            $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);

// Start Javascript patch
            if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
              echo ' <tr id="defaultSelected_' . $vendor_id . '_' . $radio_buttons . '" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ', ' . $vendor_id .')">' . "\n";
            } else {
              echo ' <tr id="defaultSelected_' . $vendor_id . '_' . $radio_buttons . '" class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ', ' . $vendor_id . ')">' . "\n";
            }
// End Javascript patch

            $shipping_actual_tax = $quotes[$i]['tax'] / 100;
            $shipping_tax = $shipping_actual_tax * $quotes[$i]['methods'][$j]['cost'];
?>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                    <td class="main" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
<?php
            if ( ($n > 1) || ($n2 > 1) ) {
?>
                    <td class="main"><?php echo $currencies->format($quotes[$i]['methods'][$j]['cost']); ?></td>
                    <td class="main" align="right">
<?php
// Javascript patch
              echo tep_draw_radio_field('shipping_' . $vendor_id, $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] . '_' . $shipping_tax, $checked, 'id="shipping_radio_' . $radio_buttons . '_' . $vendor_id . '"');              echo tep_draw_hidden_field('products_' . $vendor_id, implode("_", $products_ids));
?>
                    </td>
<?php
            } else {
?>
                    <td class="main" align="right" colspan="2"><?php echo $currencies->format($quotes[$i]['methods'][$j]['cost']) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] . '_' . $shipping_tax); ?></td>
                    <td class="main" align="right">
<?php
             echo tep_draw_hidden_field('shipping_' . $vendor_id, $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] . '_' . $shipping_tax);
              echo tep_draw_hidden_field('products_' . $vendor_id, implode("_", $products_ids));
?>
                    </td>
<?php
            }
?>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                  </tr>
<?php
            $radio_buttons++;
          }
        }
?>
                </table></td>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
<?php
        } //count quotes
      }
?>
            </table></td>
          </tr>
<!--		  </tbody>
        </table>
      </div> -->
         </table>
      </div>
      </div> <!--line 87 -->

<?php
    }
?>

Share this post


Link to post
Share on other sites

The checkout_process.php does not output anything to the browser, so it should not need any changes for BS. The 2.3.4 version should work as is.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
Posted (edited)

I stumbled across this post today... I'm right here trying to implement this.  I'd like the "catalog/includes/modules/vendor_shipping.php" (embedded in the checkout_shipping.php) page to have the same "bootstrap feel" as the other pages.  So, I'm in the same predicament.

I was able to get it to work with the 2.3.4 version of MVS, but I'd like it to be upgraded to the BS version.

I almost had it, but I couldn't get the radio buttons to work right unless I put in the Javascript patch.

Can anyone explain why a Javascript patch is needed?

As you can see in my test store (pic attached) the radio buttons are outside of the DIV that shows the title of the shipping option.  I'd like it to be pulled inside that and not in a separate row.

 

I also posted the code in question that I need help with:

<?php
      $products_ids = $vendor_data['products_id'];
      foreach ($products_ids as $product_id) {
        $products_query = tep_db_query("select products_name
			                                  from " . TABLE_PRODUCTS_DESCRIPTION . "
			                                  where products_id = '" . (int)$product_id . "'
			                                    and language_id = '" . (int)$languages_id . "'"
                                      );
        $products = tep_db_fetch_array($products_query);
        //echo $products['products_name'];
	  }
?>

  <div class="contentText">
    <table class="table table-striped table-condensed table-hover">
      <tbody>
	  

<?php
      if (count($quotes) > 1) {
?>
       <div class="contentText">
         <div class="alert alert-warning">
           <div class="row">
             <div class="col-xs-8">
               <?php echo 'Please select the preferred shipping option for the <b>' . $products['products_name'] . '</b>'; ?>
             </div>
              <div class="col-xs-4 text-right">
               <?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?>
             </div>
           </div>
         </div>
       </div>
<?php
      } elseif ($free_shipping == false) {
?>
       <div class="contentText">
         <div class="alert alert-info"><?php echo 'This is the only shipping method available for the <b>' . $products['products_name'] . '</b>'; ?>
       </div>
<?php
      }
	
	if ($free_shipping == true) {  
	?>
	<div class="contentText">
      <div class="panel panel-success">
        <div class="panel-heading"><strong><?php echo FREE_SHIPPING_TITLE; ?></strong>&nbsp;<?php echo $quotes[$i]['icon']; ?></div>
        <div class="panel-body">
          <?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?>
        </div>
      </div>
    </div>


<?php
    } else {
		
	  $radio_buttons = 0;	
	  
      for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
        

?>
      <tr class="table-selection">
        <td>
          <strong><?php echo $quotes[$i]['module']; ?></strong>
          <?php
          if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) echo '&nbsp;' . $quotes[$i]['icon'];
          ?>

          <?php
          if (isset($quotes[$i]['error'])) {
            echo '<div class="help-block">' . $quotes[$i]['error'] . '</div>';
          } else {
			
			for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {  
			  
		        $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);
            
		

     
		  
   		    if (tep_not_null($quotes[$i]['methods'][$j]['title'])) echo '<div class="help-block">' . $quotes[$i]['methods'][$j]['title'] . '</div>';

// Start Javascript patch
            if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
              echo ' <tr id="defaultSelected_' . $vendor_id . '_' . $radio_buttons . '" onclick="selectRowEffect(this, ' . $radio_buttons . ', ' . $vendor_id .')">' ;
            } else {
              echo ' <tr id="defaultSelected_' . $vendor_id . '_' . $radio_buttons . '"  onclick="selectRowEffect(this, ' . $radio_buttons . ', ' . $vendor_id . ')">' ;
            }
// End Javascript patch		  
          
          ?>
          </td>

<?php
            if ( ($n > 1) || ($n2 > 1) ) {
?>

        <td align="right">
          <?php
          if (isset($quotes[$i]['error'])) {
            // nothing
            echo '&nbsp;';
          }
          else {
            echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?>&nbsp;&nbsp;
			<?php echo tep_draw_radio_field('shipping_' . $vendor_id, $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'required aria-required="true" id="shipping_radio_' . $radio_buttons . '_' . $vendor_id . '"');
			
			echo tep_draw_hidden_field('products_' . $vendor_id, implode("_", $products_ids));
          }
          ?>
        </td>

<?php
            } else {
?>

        <td align="right"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); 
		echo tep_draw_hidden_field('products_' . $vendor_id, implode("_", $products_ids));

		
		?></td>

<?php
            }
?>

      </tr>

<?php
        
	  
	  $radio_buttons++;
			}
      }
    }
	}
?>
  
  	  
	      </tbody>
    </table>
  </div>  

 

osc_post.PNG

Edited by phi148

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×