VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: juanvilchez on July 30, 2020, 15:32:36 PM

Title: Shipment Methods. New column for "Price" ?
Post by: juanvilchez on July 30, 2020, 15:32:36 PM
Shipment Methods

It would be great and very useful to have a new column called "Price" in the backend. To sort all the shipment methods and "identify" which are more expensive, and which are more economic. Also to search for possible mistakes when entering data.

In my store I have 1728 possible shipment methods (because my shipping agency makes a really 'precise' calculation according to state, weight and volume of the parcel). And whenever I need to check them, I have to go inside and select the 2nd tab "Configuration". The way I propose, all that data would be visible from the "Shipment Methods" list.

I know this feature will not be very desired for people with 5 or 10 shipment methods, but for people like me it could be a game changer in usability.

I chose Virtuemart precisely for the flexibility when dealing with intricated shipment methods, but a little help would be very welcome ;)



If someone manages to get this feature up and running, a bounty of 15€ via Paypal is waiting for him.

And also, if the main development team considers this feature stable, reliable and useful for other VM users as well, the code will be shared to be included in base VM.
Title: Re: Shipment Methods. New column for "Price" ?
Post by: pinochico on July 30, 2020, 16:43:11 PM
We have 8 eshop in Europe and every eshop has min > 80 shipping method...
We don't need new collumn Price :)

Thanks VM DEV.
Title: Re: Shipment Methods. New column for "Price" ?
Post by: AH on July 30, 2020, 17:15:41 PM
QuoteWe have 8 eshop in Europe and every eshop has min > 80 shipping method...
We don't need new collumn Price :)

Thanks VM DEV.

No idea what that above all is meant to mean - neither useful or informative IMHO.

Even with a relatively small number of shipment methods it is very difficult (and time consuming) to see what has actually been configured.

Making a generic list is complicated, as much of the shipping method configuration is stored as "params" this allows a great degree of flexibility to plugin developers, but makes it pretty much impossible to create a generic list display outside of what is currently given.

Therefore a "generic" solution is unlikely.

You can create a customised shipping list display to separate the "params" from the shipping plugin, then you can display what you want (see image)

But there is no sorting (as this requires changes deeper in the VM codebase :-()

If you want to have a go at breaking down the params for viewing on the list - this code may be a useful start BUT none of this will help you sort by the newly available data
You can add this code in an override to the shipment list view in admin (default.php)


$qparams = explode('|', $row->shipment_params);
$qparams = str_replace('"', '', $qparams);
// clean out the parameters for each method just in case a parameters is not set or no longer used
$params = array();
foreach ($qparams as $k => $v){
if(!empty($v)){
$key_value = explode('=', $v);
if(isset($key_value[0]))
{
if(!empty( $key_value[1])) {
$params[$key_value[0]] = $key_value[1];
} else {
$params[$key_value[0]] = "";
}
}
}
}

You can then attempt to show the parameters that your plugin has stored:-

Fee display may look like this:


echo $params['shipment_cost']


Weight ranges may look like this


echo $params['weight_start'] ." to". $params['weight_stop']



Title: Re: Shipment Methods. New column for "Price" ?
Post by: juanvilchez on July 30, 2020, 17:18:08 PM
Quote from: pinochico on July 30, 2020, 16:43:11 PM
We don't need new collumn Price :)

Good for you!

We sell products from 0,5Kg to 500Kg, to 50 different states (provinces). And each of them has a different price according to weight (Kg) and volume (dm²).

I made a simplified list of "only" 1728 possible combinations, reducing considerably all the combinations to just the ones that differ in more than 0,50€
Title: Re: Shipment Methods. New column for "Price" ?
Post by: juanvilchez on July 30, 2020, 17:20:45 PM
Quote from: AH on July 30, 2020, 17:15:41 PM

Even with a relatively small number of shipment methods it is very difficult (and time consuming) to see what has actually been configured.

Your solution is more than appreciated. Thank you.

Please send me your Paypal address in private message.
Title: Re: Shipment Methods. New column for "Price" ?
Post by: AH on July 30, 2020, 17:25:22 PM
 juanvilchez

Don't get irate.  I have noted the relevance of your quest :-)

This is unlikely to get anywhere neat core due to the params storage I explained.

Someone may know how to do some clever java sorting in a view override of the admin shipping method list without hitting VM core.

Unfortunately €15 is small even for code relating to the separation of params.

NOTE: I take payment or undertake any paid work from this forum.
Title: Re: Shipment Methods. New column for "Price" ?
Post by: pinochico on July 30, 2020, 19:12:17 PM
QuoteWe sell products from 0,5Kg to 500Kg, to 50 different states (provinces).

We too and good for you too !:)
In our eshops all countries from eu and non-eu has a lot of the same shipping (PPL, DPD, DHL, GLS, Herves, Colissimo...) with the few shipments by weight from 0-50kg per 1 kg and by order value...
All info I wrote in description and that is enough, because all info are in array params in DB and are not easy loading and putting in collumn.

You can create override, write custom function, use help from AH - you can do it what do you want :)
But this option is not logic for change core - that is my basic idea.

Nice day :)
Title: Re: Shipment Methods. New column for "Price" ?
Post by: diri on July 31, 2020, 07:29:01 AM
@pinochio

The origin question is not that unreasonable like you try to set it. In VM there is no real solution for this problem except custom coding.

You will think about the question in more depth when you transfer it to a worldwide shop. Economic has been something important since ages (even when transport costs are very low nowadays).

Take many stock locations spread on world, products not available near customer's address, ...

Hint, a very short description:
Mid of 1990s there has been start of development of a shop system with 12 master DBs spread worldwide. Selection of stock location being used to send product to customer has been automatic first moment but, customer could always choose another location to get anything or part of order faster / cheaper / whatever. In the end I like to call it Am*z**++. Since ~ 2000 there's at least one patent on this system (worldwide).
Title: Re: Shipment Methods. New column for "Price" ?
Post by: AH on July 31, 2020, 10:00:53 AM
juanvilchez

This is a customised view - it should work for the default shipping plugin

Header text is hardcoded (my Spanish is not up to translating it) as is the euro symbol.

Place it in the appropriate admin override folder:

\administrator\templates\isis\html\com_virtuemart\shipmentmethod\default.php

This may help others, BUT NOTE, it is plugin specific based on params available to the base shipping plugin