VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: andrai2 on February 10, 2014, 14:37:32 PM

Title: Modify shipment methods layout
Post by: andrai2 on February 10, 2014, 14:37:32 PM
Hello!

I am making a virtuemart website, and i have more than 100 shipment methods (basicly they are post stations, where people can get their product). I want to modify shipment method layout (in the attachment i draw my idea) As i have more than 100 shipment methods, i want to seperate them by title (city name). The idea is like that:
City name1
Shipment method1
Shipment method1
Shipment method1
City name1
Shipment method1
Shipment method1
Shipment method
City name1
Shipment method1
Shipment method1
Shipment method

May be someone knows how can i achieve this ad city title into shipment methods?

As i understand i have to modife select_shipment.php or database, but no luck

Thanks anyway!
I have get many useful answers in this forum


[attachment cleanup by admin]
Title: Re: Modify shipment methods layout
Post by: blizam on February 11, 2014, 07:46:47 AM
Ok... so I decided to give this a shot... I'm gonna be in the VM game a long time and I'm trying to build some karma on this board, cause I'm gonna need it.

That being said, I'm a total noob...

But if it was me... I'd try this:

-make sure you're running very latest VM code
-create an override in template_name/html/com_virtuemart/cart/select_shipment.php
--use the normal one in components/com_virtuemart/views/cart/tmpl as a base if you need to
-in the over ride remove/comment out the following block starting on line 54 in the regular file:


<?php
    
if ($this->found_shipment_method  ) {

   echo "<fieldset>\n";
// 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) {
echo $shipment_shipment_rate."<br />\n";
    }
}
    }
    echo "</fieldset>\n";
    } else {
 echo "<h".$headerLevel.">".$this->shipment_not_found_text."</h".$headerLevel.">";
    }


if (
$this->layoutName!='default') {
?>



and replace it with:


<fieldset>
<p><ul><li>whatever hard-coded list of shipment methods, and cities, you have</li></ul></p>
</fieldset>


least that's where it looks like to me the choices are generated... if you want the current foreach loop there to dynamically spit out a city name for several shipment methods youre gonna have to add a row in the db to keep track of city names and methods they're associated with, and add that logic to the loop.

Good luck! Hope it at least helps in some small way...
Title: Re: Modify shipment methods layout
Post by: andrai2 on February 11, 2014, 15:39:51 PM
Thanks man, will try to work it out!