Author Topic: Custom VM Shipment Plugin Development  (Read 363 times)

cmsdev

  • Beginner
  • *
  • Posts: 5
  • A beginner
Custom VM Shipment Plugin Development
« 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^

Code: [Select]
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

  • Beginner
  • *
  • Posts: 5
  • A beginner
Re: Custom VM Shipment Plugin
« Reply #1 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.

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1658
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Custom VM Shipment Plugin Development
« Reply #2 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 :)


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