New Shipping Module - WHIP - Customizable Alogorithms - Shipper Rate Integration

Started by btgroup, August 29, 2006, 19:53:28 PM

Previous topic - Next topic

btgroup

This was originally just a basic weight based shipping module that evolved to include customizable algorithms and integration with the Shipper Client / Shipper Rate database.

Download the Latest @ http://software.byrgius.com/ or the file below these instructions.

* WHIP Shipping Module for Joomla! VirtueMart Component ----------------------------------------- **

  Filename:       WHIP_README.txt
  Version:        1.1.3
  Release Date:   10/12/06
  Developer:      David Hunt
  Copyright:      2006 Byrgius Technologies
  License:        GNU/GPL (http://www.gnu.org/copyleft/gpl.html)
  Source:         http://software.byrgius.com/

* Package Files --------------------------------------------------------------------------------- **

  whip.php
  whip.ini
  whip_config/whip.default.cfg.php
  whip_config/whip.factory_volume.cfg.php
  whip_config/whip.factory_weight.cfg.php
  WHIP_README.txt

* Overview -------------------------------------------------------------------------------------- **

  The WHIP Shipping Module provides customizable shipment algorithms for calculating the
  total shipment cost based on Shipment Weight, Shipment Volume, a combination of weight
  & volume or neither.  The WHIP Shipment Module can be used independantly or with the
  Shipper/Rates database to provide multiple Shipper Rate criteria based on Shipment
  Quantity, etc...

* v1.1.3 Updates -------------------------------------------------------------------------------- **

  1) 'shipping_rate_id' key checking in $d array, improvement on list building

* v1.1.2 Updates -------------------------------------------------------------------------------- **

  1) Fixed WHIP_USE_SHIPPER Option Select

* v1.1.1 Updates -------------------------------------------------------------------------------- **

  1) JS Field Checks for Algorithms in Admin

  2) Added Field Names to Admin Config

  3) Check if value is_array before attempting to replace within Algorithm
 
  4) Fixed $_SESSION bug for Checkout Selection

* v1.1.0 Updates -------------------------------------------------------------------------------- **

  1) Volume Calculation and Inclusion into Algorithms

  2) Multiple Country Configuration options

  3) JS managed interface for managing your country configurations

* Golden Nuggets -------------------------------------------------------------------------------- **

  1) CHMOD 777 - Write Access is required to the configuration folder:
        com_virtuemart/classes/shipping/whip_config/

  2) DO NOT DELETE / RENAME:
       whip_config/whip.default.cfg.php
       whip_config/whip.factory_weight.cfg.php
       whip_config/whip.factory_volume.cfg.php

  3) Only Countries Edited are Saved, all other countries refer to "Default Configuration"

  4) Once a country configuration is saved it is active. To remove the country you must
     delete the appropriate configuration file in the whip_config folder.

  5) The config file naming convention is:
       whip_config/whip.{country_3_code}.cfg.php

* Installation Instructions --------------------------------------------------------------------- **

  1) Extract the contents of the .ZIP file into the folder:
        /administrator/components/com_virtuemart/classes/shipping

  2) Set the permissions on the new shipping sub-folder ( whip_config ) to
     be writable ( CHMOD 777 )

     * SECURITY NOTE *
       Once you have configured the WHIP Shipping Module to the desired settings, it is
       good practice to change the permissions on the "whip_config" folder and the
       contained configuration files to "Read Only" ( CHMOD 644 )

  3) Load your VirtueMart interface and navigate to "Admin -> Configuration "

  4) Under the "Shipping" tab, activate the "WHIP Shipping" module & SAVE

  5) Navigate to "Store -> Shipping Module List" and select the "Configure Ship Method"
     for the "WHIP" module

* Configuring WHIP ----------------------------------------------------------------------------- **

  Refer to the following screenshot if necessary:
     http://software.byrgius.com/WHIP_for_VirtueMart/whip_screenshot_v1.1.jpg

  1) At the top you have a Country Selector.  The first option is the "Default Configuration."

        * NOTE: Undefined Countries refers to the "Default Configuration" *

  2) The "Copy Settings" buttons below the Country Selector allow you to copy settings from
     the "Default Configuration" into the fields for active country.  In addition to copying the
     "Default Configuration", there are two "Factory" settings available for correcting mistakes.

  3) Below the "Copy Settings" options are the configuration fields for the selected country.
     Every configuration value within the dark boreder will be recorded uniquely for each country.

  4) Make sure to press the "SAVE" button once you are finished.

* v1.1.3 Screenshot ----------------------------------------------------------------------------- **


* END ------------------------------------------------------------------------------------------- **


[attachment cleanup by admin]

Pixyfrog

I have not tried it yet but this looks AWESOME... thanks for this great contribution to the Virtue Mart community

Pixyfrog

I seem to have some difficulty in using your module, possibly due to wrong configuration on my end.

The installation process was smooth and without surprise.

I have configured only a "default" parameter page and activated your component.

Now when I test it, I have this error reported on the front end while checking out (shipping page)

Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement in an array. in /home/tangibl1/public_html/administrator/components/com_virtuemart/classes/shipping/whip.php on line 169

Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement in an array. in /home/tangibl1/public_html/administrator/components/com_virtuemart/classes/shipping/whip.php on line 169

Parse error: parse error, unexpected ';' in /home/tangibl1/public_html/administrator/components/com_virtuemart/classes/shipping/whip.php(178) : eval()'d code on line 1
ERROR - Config [default] Algorithm []

Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement in an array. in /home/tangibl1/public_html/administrator/components/com_virtuemart/classes/shipping/whip.php on line 169

Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement in an array. in /home/tangibl1/public_html/administrator/components/com_virtuemart/classes/shipping/whip.php on line 169

Parse error: parse error, unexpected ';' in /home/tangibl1/public_html/administrator/components/com_virtuemart/classes/shipping/whip.php(178) : eval()'d code on line 1
ERROR - Config [default] Algorithm


I am using VM 1.0.4 and Joomla 1.0.11. Any help will be greatly appreciated.

Pixyfrog

... and one more thing, I do not quite understand how is this module working together with the Shipping rate Database. Thanks for sharing your lights.

btgroup

I'm looking into the error now...

With the Shipper Integration, you can utilize the values in the Shipper database for more dynamic calculations

IE: When the visitor gets to the Shipper Selection phase of checkout, they will be presented with a list of available shippers (those setup in the VirtueMart shipper mgr) - the selected shipper values will be available for the WHIP algorithm.

It is simply a way for you to create a more dynamic calculation by having more configuration options (shipper values) available at checkout.

Does that make sense?

btgroup

Ok - I've uploaded the newest version to my server and attached it to this thread - I'm going to keep the newest version attached to the first post on this thread so it's hopefully easier to find - the DocMan download section of this website is not being updated by Soren as quickly as these updates are being released.

The problem with the error you experienced was due to an ARRAY being passed to the algorithm for replacement - this array was not part of my testing environment, it may be a plugin you are using or something that has changed in the newest release of VirtueMart.  In any case, a quick "is_array" check should take care of the problem.

Refer to the first post of the thread or http://software.byrgius.com for the newest version.

Thanks for the heads up on the error - I hope this module is helpful for the community!!

Pixyfrog

Thanks for such a quick turnaround.

I installed the new version and the bug reported earlier has vanished!

Now here is another thing that puzzle me: I cannot seem to uncheck the "use shipper details:" check box. All the other parameters get saved properly, but this check box always apears to be "checked" when I open the config page, even though I had saved it unchecked.

I have checked the access rights for the whip_config folder and it is set to 777, so the problem does not seem to come from there.

Anyway, I DO need to use the shipper details in my case and I have been able to implement my shipping cost model thanks to your great contribution.

btgroup

No sweat - you're the first to give me some debug response - I'd like this to be working so I can walk away knowing it's useful.

The version 1.1.2 has the issue with the select box fixed.

Thanks again for taking the time to update the thread! ;D


Pixyfrog

Hi there!

Your last updates  1.1.2 has fixed the check box issue. I will let you know if I find anything else.

Thanks again, cheers.

alatak

#9
Hi,

Thank you for this new module. I was exactly looking for this kind of module.

I have the following error while checking out my order:

Notice: Undefined index: shipping_rate_id in xxxx\administrator\components\com_virtuemart\classes\shipping\whip.php on line 96


Do you have any idea?

Thanks,

btgroup

The code is not performing a check on the checkout array to confirm that a shipping_rate_id has been previously defined - this is an oversight on my part that with most default PHP installations would not be an issue.  In your case it appears that warnings are turned on in your PHP configuration (not a bad thing - my code should be checking these values for compliancy)

Here is the Solution: Replace line 96 in the file WHIP.PHP with the following:

        // if(($d["shipping_rate_id"] == $shipping_rate_id) || $first)
        if((array_key_exists('shipping_rate_id',$d) && ($d["shipping_rate_id"] == $shipping_rate_id)) || $first)

I will release an upgrade that will include more checking to resolve this issue permanently.  Thank you for posting the issue!

alatak

Hi,

Thank you very much for your answer.
I have another problem :
when testing on this plateform:  PHP5.1.4, it does not recognize the sign <?=.

But I have no problem with 4.3.10.

It is probably my problem, but I have no idea what to do to correct it.

btgroup

You have got to be kidding me - the new PHP doesn't allow that shorthand expression?

I've been using that in all my code - I like it, it's clean - is it every instance of the expression "<?=" that fails?

BAAA!!

alatak

Hi,

This afternoon I have installed your module on a PHP 5.1.6 and it works perfectly.

So It is probably a problem on my local computer ...but I don't know what ...

btgroup

Well hopefully it is a glitch (since I've got so much code with that shorthand) - thanks for the head up!!