VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: cmsdev on September 16, 2022, 11:09:02 AM

Title: Custom VM Shipment Plugin Development
Post by: cmsdev on September 16, 2022, 11:09:02 AM
Hi, everybody!

Joomla 3.10.11
VM 4.0.6

I'm trying to make my first VM plugin which is intended to add custom field in the cart to chosen shipping method and let user to select pick-up point for the method.

Now I'm trying to start from something but can't get beyond the point of display anything in the cart.

Here's my code at the moment^


class plgVmMyShipment extends vmPSPlugin {

    function __construct (& $subject, $config) {
parent::__construct ($subject, $config);
        $this->_loggable = TRUE;
        $varsToPush = $this->getVarsToPush ();
}
   
        public function plgVmDisplayListFEShipment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {

              $my_id = 10;

              $html .= '<input type="radio" name="virtuemart_shipmentmethod_id" id="shipment_id_'.

                            $my_id.'" value="'.$my_id.'">';


              $html .= '<label for="shipment_id_'.$my_id.'"><span class="vmshipment">';

              $html .= '<span class="vmshipment_name"> My Shipment </span>';

              $html .= '<span class="vmshipment_description">';
             
              $html .= 'Test description</span>';

              $html .= '<span class="vmshipment_cost">('.number_format(100, 2, ",", "").' €)</span></span></label>';

              $htmlIn[] = array($html);
             
            return true;
       }

}


Also I can't get to work vmdebug function or anything else from inside the plugin class functions.

Can you please point me the right direction and maybe suggest what I can do for the start to at least to show something on the cart page? I would be able to do more research if I at least get some visible reaction from the plugin functions.
Title: Re: Custom VM Shipment Plugin
Post by: cmsdev on September 25, 2022, 18:29:34 PM
Ok, guys, I think it might be useful for someone. The cause of zero reaction from plugin's functions is a class naming (noob mistake).

I didn't pay proper attention to the Joomla plugins class naming (plg<PluginGroup><PluginName>) and named the class plgVmMyShipment instead of plgVmShipmentMyShipment.

After that fix I see the reaction from the plugin on the site.
Title: Re: Custom VM Shipment Plugin Development
Post by: pinochico on September 25, 2022, 20:13:55 PM
A lot of shipment PICK-UP plugin for VM we have as plugin for Rupostel OPC Zasilkovna:
- Zasilkovna OPC - plugin SK SPS - Parcel Shops - SK
- Zasilkovna OPC - plugin PL InPost - Pop - PL
- Zasilkovna OPC - plugin PL InPost - Paczkomaty Box - PL
- Zasilkovna OPC - plugin FR Mondial PP - FR
- Zasilkovna OPC - plugin FR Colissimo PP - FR
- Zasilkovna OPC - plugin PPL ParcelShop - CZ
- Zasilkovna OPC - plugin Ceska Posta - Balik na postu - CZ
- Zasilkovna OPC - plugin Ceska Posta - Balikovna - CZ
- Zasilkovna OPC - plugin Slovenska Posta - Balik na postu - SK
- Zasilkovna OPC - plugin Slovenska Posta - Balikovna - SK
- Zasilkovna OPC - plugin DE Hermes PP - DE

If you want we can create for you other :)


Title: Re: Custom VM Shipment Plugin Development
Post by: ec83 on May 10, 2023, 08:48:19 AM
Hello, I see in your exchanges that you mention a Mondial FR delivery plugin. I guess it's Mondial Relay.
This plugin interests me to offer Mondial Relay delivery to customers.
Is this plugin functional on Joomla 4 and Virtuemart 4?

Thanks
Title: Re: Custom VM Shipment Plugin Development
Post by: pinochico on May 11, 2023, 10:40:05 AM
send me PM
Title: Re: Custom VM Shipment Plugin Development
Post by: Studio 42 on May 12, 2023, 00:26:30 AM
ec83 alatak.net is a french developer you can find the Mondial Relay plugin here https://alatak.net/expedition-virtuemart-2-et-3/mondial-relay.html
Title: Re: Custom VM Shipment Plugin Development
Post by: ec83 on May 15, 2023, 09:19:51 AM
Hello,
I tried to contact Alatak these last days without success... That's why I ask for a feedback from the community ;) I think I'll have to buy the plugin to do my tests I'll see... I  will make a return