VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: TCF on May 04, 2012, 08:55:46 AM

Title: Indonesia Shipment and Drop Down Shipper List
Post by: TCF on May 04, 2012, 08:55:46 AM
Hi, first sorry for my poor English.

I have two issues :

1. I'm using Joomla 2.5 and Virtuemart 2.0.6 with "VM - Shipment, By weight, ZIP and countries" Plugin. My online shop only sell products for local customers and doesn't need International shipment rates, and from my experience with VM 1, i know what to do. But because there are many cities with different shipping cost, I have to create lots of shipment methods and add each city to my list. No need to worry, i have enough time to work on it.

The problem is : I can't multiple the weight for each method. I set the standard 0.1kg - 1kg a basic price for each method. So if a customer bought many products with total weight bigger than 1kg, the shipment method didn't work. What should I do? Of course i can't create more shipment method for each city for weight 1.1kg - 2kg, 2.1kg-3kg and so on, I already have 50++ cities in my list. I tried "VMSHIPMENT_PRO_SHIP" but didn't work either.

2. Because i have more than 50 cities in my list, my Select Shipment page has long list radio button. I want to know how to create drop down list for Shippers to make my page prettier.

Edit : I was trying to ask a question, but in the end I solve the problem myself, so i like to share it here in case anybody need it.

Quotehttp://blablabla.com/index.php/component/virtuemart/cart/edit_shipment?Itemid=0

Before : I have long list of city shipping cost (50 cities and counting)
(http://i.imgur.com/Gd8R9.jpg)

After : I can choose a city shipping cost from a drop down menu
(http://i.imgur.com/3ppFh.jpg)

Here's the trick : Edit /components/com_virtuemart/views/cart/tmpl/select_shipment.php
You should understand what i mean with /*********** Add ***********/ and /*********** EDIT ***********/

<?php
/**
 *
 * Template for the shipment selection
 *
 * @package VirtueMart
 * @subpackage Cart
 * @author Max Milbers
 *
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: cart.php 2400 2010-05-11 19:30:47Z milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

?>


<?php
if (VmConfig::get('oncheckout_show_steps'1)) {
    echo 
'<div class="checkoutStep" id="checkoutStep2">' JText::_('COM_VIRTUEMART_USER_FORM_CART_STEP2') . '</div>';
}
    
/*********** Add ***********/
    
function extractstr ($content$start$end){
        if (((
$content AND $start) AND $end)){
              
$r explode ($start$content);
              if (isset (
$r[1])){
                
$r explode ($end$r[1]);
                return 
$r[0];
              }
        return 
'';
        }
    }
    
/*********** Add ***********/
?>

<form method="post" id="userForm" name="chooseShipmentRate" action="<?php echo JRoute::_('index.php'); ?>" class="form-validate">
<?php

echo 
"<h1>".JText::_('COM_VIRTUEMART_CART_SELECT_SHIPMENT')."</h1>";
if($this->cart->getInCheckOut()){
$buttonclass 'button vm-button-correct';
} else {
$buttonclass 'default';
}
?>

<div class="buttonBar-right">

        <button class="<?php echo $buttonclass ?>" type="submit" ><?php echo JText::_('COM_VIRTUEMART_SAVE'); ?></button>  &nbsp;
<button class="<?php echo $buttonclass ?>" type="reset" onClick="window.location.href='<?php echo JRoute::_('index.php?option=com_virtuemart&view=cart'); ?>'" ><?php echo JText::_('COM_VIRTUEMART_CANCEL'); ?></button>
</div>
<?php
    
if ($this->found_shipment_method) {
        
/*********** EDIT ***********/
        
echo '<label for="group1"><img align="middle" src="http://blablacla.com/images/stories/virtuemart/shipment/shipperlogo.jpg"  alt="logo" /></label>\n';
        echo 
'<select id="group1" name="virtuemart_shipmentmethod_id">\n';
        
/*********** EDIT ***********/
// if only one Shipment , should be checked by default
    foreach ($this->shipments_shipment_rates as $shipment_shipment_rates) {
if (is_array($shipment_shipment_rates)) {
    foreach ($shipment_shipment_rates as $shipment_shipment_rate) {
                   
/*********** EDIT ***********/
                    
$shipment_value=extractstr($shipment_shipment_rate,'value="','"');
                    
$shipment_text=extractstr($shipment_shipment_rate,'<span class="vmshipment">','</span>');
                    echo 
'<option value="'.$shipment_value.'">'.$shipment_text.'</option><br />\n';
                    
/*********** EDIT ***********/
    }
}
    }
        
/*********** EDIT ***********/
        
echo "</select>\n";
        
/*********** EDIT ***********/
    
} else {
 echo "<h1>".$this->shipment_not_found_text."</h1>";
    }

    
?>


    <input type="hidden" name="option" value="com_virtuemart" />
    <input type="hidden" name="view" value="cart" />
    <input type="hidden" name="task" value="setshipment" />
    <input type="hidden" name="controller" value="cart" />
</form>


But i'm still not satisfied because i can't see the price in the drop down menu. Last thing, i want the cities sorted in alphabetical order. Anybody can help me?

Thanks.
Title: Re: Indonesia Shipment and Drop Down Shipper List
Post by: mesinrusak on June 03, 2012, 06:05:25 AM

show price
change :

$shipment_text=extractstr($shipment_shipment_rate,'<span class="vmshipment">','</span>');


become:
$shipment_text1=extractstr($shipment_shipment_rate,'<span class="vmshipment_name">','</span>');
$shipment_text2=extractstr($shipment_shipment_rate,'<span class="vmshipment_cost">','</span>');
$shipment_text=$shipment_text1.' '.$shipment_text2;


sort
use facility List Order at Shipment Method Information
Title: Re: Indonesia Shipment and Drop Down Shipper List
Post by: TCF on June 03, 2012, 06:31:50 AM
Quote from: mesinrusak on June 03, 2012, 06:05:25 AM

show price
change :

$shipment_text=extractstr($shipment_shipment_rate,'<span class="vmshipment">','</span>');


become:
$shipment_text1=extractstr($shipment_shipment_rate,'<span class="vmshipment_name">','</span>');
$shipment_text2=extractstr($shipment_shipment_rate,'<span class="vmshipment_cost">','</span>');
$shipment_text=$shipment_text1.' '.$shipment_text2;


sort
use facility List Order at Shipment Method Information

Thanks bro, appreciate it :)

Do you have plugin for JNE? I still need to solve the multiple weight problem. And last question : where's Facility List Order?

Once again, thank you very much :)

Title: Re: Indonesia Shipment and Drop Down Shipper List
Post by: vickies on June 13, 2012, 18:14:50 PM
how about at Joomla 1.5.23 and Virtuemart V. 1.1.9 :( help please.
Title: Re: Indonesia Shipment and Drop Down Shipper List
Post by: TCF on July 06, 2012, 04:00:14 AM
Hi,

I update to latest version VM 2.08 with AIO updated too, but my first problem about weight more than 1kg still occured. Anybody have the solution?

Thanks
Title: Re: Indonesia Shipment and Drop Down Shipper List
Post by: jacobian64 on October 15, 2017, 10:23:15 AM
can you tell me how to apply this modification to a newer version of virtuemart? I haven't been able to do it successfully yet.