News:

Support the VirtueMart project and become a member

Main Menu

Custom VM Shipment Plugin Development

Started by cmsdev, September 16, 2022, 11:09:02 AM

Previous topic - Next topic

cmsdev

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.

cmsdev

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.

pinochico

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 :)


www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

ec83

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

pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Studio 42


ec83

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