New Standard Shipping Plugin with Free Shipping Categories and Products by ID

Started by WebStuff, February 18, 2013, 19:49:12 PM

Previous topic - Next topic

WebStuff

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]

neilwhit

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?
Joomla v2.5.9

WebStuff

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]

ryandiaz

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?
[glow=red,2,300]Joomla 1.5.22 | Virtuemart 1.1.6 Stable | PHP 5.3.13[/glow]

neilwhit

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)
Joomla v2.5.9

WebStuff

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.

WebStuff

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.

WebStuff

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.

neilwhit

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.
Joomla v2.5.9

WebStuff

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.

neilwhit

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.
Joomla v2.5.9

WebStuff

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?


WebStuff

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.

neilwhit

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.
Joomla v2.5.9