VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: WebStuff on February 18, 2013, 19:49:12 PM

Title: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on February 18, 2013, 19:49:12 PM
I've made a modification to the Standard Shipment Plugin.
Would anyone like to test it and see if they come up with anything wrong or something isn't logical.
Basically it just adds a few comma separated lists of category ids and product ids that should not be charged any shipping and/or packaging fee.
I've attached a screen shot and the files below.

If all goes well I'll get it uploaded to the extensions site. License is GPL feel free to modify, etc. :)

Thanks.

[attachment cleanup by admin]
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: neilwhit on April 24, 2013, 19:54:04 PM
Tried your plug-in, but I get a white screen when trying to select the shipping method during checkout. VM 2.0.12f/JM2.5.9.

Could really use this since I would like to have free shipping on certain items and/or a category. Any updates or ideas?
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on April 30, 2013, 12:44:27 PM
Quote from: neilwhit on April 24, 2013, 19:54:04 PM
Tried your plug-in, but I get a white screen when trying to select the shipping method during checkout. VM 2.0.12f/JM2.5.9.

Could really use this since I would like to have free shipping on certain items and/or a category. Any updates or ideas?
Is this after you select the shipping method and click Save or is the white screen when the methods are listed?

There is a typo in the php file for the translations, this should be COM_VIRTUEMART_CART_FREE_SHIPPING instead of COM_VIRTUEMART_PLUGIN_COST_DISPLAY_FREE
This shouldn't stop it working. I'll upload a new zip file which I know is working on my system just in case it is something I have done since the last upload.


[attachment cleanup by admin]
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: ryandiaz on April 30, 2013, 16:22:50 PM
With your changes, do the product ids and category ids always receive free shipping.  Or, do they still have to reach the "Minimum amount for free shipping" specified in the shipping plugin?
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: neilwhit on April 30, 2013, 16:24:35 PM
No go. This time I get a white screen when going to the shopping cart. Turn the free shipping off and the cart shows just fine. With it turned on (published), can't get to the cart at all. Last time it showed the cart, but got the white screen when going to the shipment selection screen, so this is acting differently.

Tried turing on debugging, but got no messages. The error log only shows:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on April 30, 2013, 16:46:40 PM
Quote from: ryandiaz on April 30, 2013, 16:22:50 PM
With your changes, do the product ids and category ids always receive free shipping.  Or, do they still have to reach the "Minimum amount for free shipping" specified in the shipping plugin?
No free shipping is like a bypass so if your main free shipping is £300-00 but a category id is set as free shipping even if items in that category are £5-00 then they get free shipping. This continues until the customer adds an item which is not in the categories listed or in the product id list. then the normal shipping rates kick in.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on April 30, 2013, 16:49:20 PM
Quote from: neilwhit on April 30, 2013, 16:24:35 PM
No go. This time I get a white screen when going to the shopping cart. Turn the free shipping off and the cart shows just fine. With it turned on (published), can't get to the cart at all. Last time it showed the cart, but got the white screen when going to the shipment selection screen, so this is acting differently.

Tried turing on debugging, but got no messages. The error log only shows:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Thanks for the feedback neilwhit. I'll add some vmDebug messages to the plugin and upload that in a little while or tomorrow. If you would bear with me I will do my best to get to the bottom of this.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on May 01, 2013, 18:11:44 PM
Hi neilwhit,
could you try commenting out lin 213 vmWarn (500, $q . " " . $db->getErrorMsg ());
so it looks like this //vmWarn (500, $q . " " . $db->getErrorMsg ());
This is the only place I am intentionally generating a 500 error as this checks whether an order id exists for this shiipment.
If it is still giving you a 500 error then it is something else that it can't find.
I'm on 2.0.20b now so I haven't tested on older VM's except 2.0.14 upwards. Maybe 2.0.12 has some changes that I'm not aware of.
I am swamped with work at the moment so I will have to do the vmDebug version of the plugin later this week or at weekend I'm afraid.

Hope this helps.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: neilwhit on May 01, 2013, 19:12:41 PM
Didn't make a difference. Still got blank screen.

In investigating it further, I did notice something that I had not noticed before. When I created the shipment method, saved, then set the configurations and click save, the info is not saved. All config elements are reset to blank. I looked in the database and see that the shipment_params field in shipmentmethods table has a zero. It does not update when I change things in a newly created Shipment Method using your plugin. Every time I click save, it resets all the fields. Not sure why it is not updating the table since it does create the record when the new shipment method is created and saved. Also creates the virtuemart_shipment_plg_free_shipping_items table, so that is working.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on May 01, 2013, 19:41:50 PM
try adding these line $this->_tablepkey = 'id';
$this->_tableId = 'id';

to plugins/vmshipment/free_shipping_items/free_shipping_items.php
Just below : $this->_loggable = TRUE;
So it looks like this: $this->_loggable = TRUE;
$this->_tablepkey = 'id';
$this->_tableId = 'id';
$this->tableFields = array_keys ($this->getTableSQLFields ());
$varsToPush = $this->getVarsToPush ();
$this->setConfigParameterable ($this->_configTableFieldName, $varsToPush);

You may need to delete the shipment method from VM and then create it again for this change to take effect.
Could you possible check your server error logs at the time you save the config. This may give me a clue where it is going wrong for you.. Thanks.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: neilwhit on May 01, 2013, 20:44:09 PM
No luck. Don't see anything in the error logs that looks related.

Curious that the data/info entered on the Shipment Method Info tab is retained such as the name, description, shopper groups, etc., but the info entered on the Configuration tab is not.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on May 02, 2013, 17:24:23 PM
Quote from: neilwhit on May 01, 2013, 20:44:09 PM
No luck. Don't see anything in the error logs that looks related.

Curious that the data/info entered on the Shipment Method Info tab is retained such as the name, description, shopper groups, etc., but the info entered on the Configuration tab is not.
Hi again, I have just had a question on another thread on the forum about enhancing this plugin they say that it installed for them and works fine. ??????
What PHP version are you using?
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: neilwhit on May 02, 2013, 17:42:01 PM
5.3.23
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on May 02, 2013, 18:00:11 PM
Quote from: neilwhit on May 02, 2013, 17:42:01 PM
5.3.23
That should be fine.
I think if you are comfortable with phpmyadmin or suchlike and are not in need of the entry in the table in the database I would try uninstalling completely and deleting the entry from #__virtuemart_shipmentmethods (if it remains) and renaming #__virtuemart_shipment_plg_free_shipping_items to something so it can recreate the whole install.
Have you tried the standard plugin? The only other issue is I have seen some people have problems with the cart and BackEnd with certain templates.
Are the cart pages overridden in your template. It may be some sort of relatuive file path. I just did a fresh install of the plugin on an "untouched" install I had for testing and it went fine, saved and working correctly. I'll have to getr round to adding the vmDebug messages and see what's going on.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: neilwhit on May 02, 2013, 18:03:44 PM
Looks like it is related to VM 2.0.12. I just installed it on another store using VM 2.0.20b and it does save the config info, and the shopping cart loads fine.

That said, there is still a problem in that I have specified only a single product ID for free shipping, but the free option shows up no matter what I add to the cart. I have not added the item specified in the config, but the free option shows and it lets me select it.

Do I need to specify anything else in the config other than the product ID or IDs?

It would be great if you could figure out what is going wrong with the 2.0.12 install since that is the store where it is really important. I would love to update VM on that site, but it breaks the template so badly that I cannot figure out how to upgrade without ruining the store. Kind of stuck at 2.0.12 for now.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: neilwhit on May 02, 2013, 18:09:46 PM
The template does have overrides for the VM cart (default_coupon.php, default_pricelist.php, default.php, order_done.php, select_payment.php, select_shipment.php).

Same for the other site with VM 2.0.20.

I did try a couple times to remove the tables and do a fresh install, but it didn't help.

I am using the VM - Shipment by Weight, Zip for a free shipping over $50, and it works fine on both sites.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on May 02, 2013, 18:14:28 PM
I'll check through the back changelogs for VM 2.0.12 to 2.0.14 this weekend to see if they changed anything that is effecting it. I seem to remember they had a problem with the PayPal plugin at one point so they changed the layout of that (some function names and suchlike got changed) but I can't remember which upgrade that was on.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: WebStuff on May 02, 2013, 18:21:10 PM
Quote from: neilwhit on May 02, 2013, 18:03:44 PMThat said, there is still a problem in that I have specified only a single product ID for free shipping, but the free option shows up no matter what I add to the cart. I have not added the item specified in the config, but the free option shows and it lets me select it.
This was just a module to replace the normal weight and countries with the added option of free categories. If you have other shipping options as well then it will show up if the "conditions" are correct.
You can change this behaviour but it would require another option adding to the config or a hack.
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: neilwhit on May 03, 2013, 01:03:23 AM
Quote from: mirrorsandglass on May 02, 2013, 18:21:10 PM
This was just a module to replace the normal weight and countries with the added option of free categories. If you have other shipping options as well then it will show up if the "conditions" are correct.
You can change this behaviour but it would require another option adding to the config or a hack.

1. Will it conflict if I have another Shipment Method for free shipping over a certain dollar amount?

2. When I did get it to work on the site with VM 2.0.20, the only entry I had in the config tab was an item number. However, it comes up as available on any and all items added to the cart (none of which are the item ID specified in the config). It did not work for only the item ID I had specified. Am I doing something wrong in the config?
Title: Re: New Standard Shipping Plugin with Free Shipping Categories and Products by ID
Post by: seaniemorris on May 09, 2013, 11:49:53 AM
Just tried your plugin mirrorsandglass, and it worked a treat, thanks for the work you put in!

Seanie.