[support] Ecommerce shipping/delivery rate question

Chris McGinlay chris at ascentsoftware.org.uk
Sat Nov 24 22:59:39 UTC 2007


On Wednesday 21 November 2007 15:38, Saint-Genest Gwenael wrote:

Hey, thanks for the detailed response. I should be able to use method 1 for 
what I'm trying to do. I will post again if I run into difficulty.

Thanks !

Chris

> Chris McGinlay wrote:
> > Hi,
> >
> > I'm using ecommerce 5.x-3.4, with D5.3. I have a number of products, each
> > with a unique shipping/delivery charge.
> >
> > How do you set up so that (for example) product A costs £5 to deliver and
> > product B costs £8 to deliver etc.
> >
> > Thanks
> >
> > Chris
>
> Hi !
>
>    To solve this, you can create a custom Shipping charge with
> Flexicharge [1]. I think you can have many implementations for
> this question.
>
> One example :
>  - Enable Flexicharge : this is a default ecommerce module
>  - Add a new Flexicharge argument for your products :
>     Into ecommerce/contrib/flexicharge/providers/shipping.inc
> the function shipping_flexicharge_attributes() is used to define
> arguments (like weight). Add a new custom argument like 'customtax' :
>   $fields['customtax'] = array(
>     '#type' => 'textfield',
>     '#title' => t('Custom shipping Tax'),
>     '#description' => t('The tax for this product', array()),
>     '#default_value' => '',
>   );
> Now, you can specify for each product a value into this 'customtax'
>
>   - Create a custom Flexicharge method
>       Into ecommerce/contrib/flexicharge/providers/ rename
> the default file'custom.inc.example' as 'custom.inc'.
> The function general_custom_flexicharge_calculate() will be
> used to compute total amout for you custom charge. You can implement
> (for example) something like :
> function general_custom_flexicharge_calculate(&$txn, $misc, $total) {
>   switch ($misc->operator) {
>     case FLEXICHARGE_CHARGE:
>       $customtax_total = 0;
>       foreach ((array)$txn->items as $item) {
>         $customtax_total +=
> $item->flexicharge_methods['shipping']['customtax'];
>       }
>       return $customtax_total;
>    }
> }
>
>   - Create a new charge from Drupal admin interface
> e-Commerce configuration > Flexicharge
>
>
>   This is only a skeleton of answer, if this is not clear
> i can send you files for this example.
>
> Gwen
>
> [1] An example if available for discount : http://drupal.org/node/135862
>
> -
> Saint-Genest Gwenael <gwenael.saint-genest at makina-corpus.com>
> Makina Corpus - http://www.makina-corpus.com/


More information about the support mailing list