4 replies [Last post]
seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
Was this information Helpful?

I am just finishing a photography website (www.daleypix.com) and would find it very helpful to be able to setup shipping based on the attribute and option selected by the customer. I have setup one attribute and with options that are the various sizes in which a photograph could be purchased. I have chosen to do flat rate shipments and wish to charge different amounts of shipping for different product sizes. For example, charging $100.00 for shipping for a 30x40" framed photograph, $25.00 for a 14x20" canvas print, or no charge for a 5x7" proof print.

It seems to me to work best if I could have the workflow-ng module be able to look at the product options. I can't find that and haven't figured out how to add the ability to look for the attribute/option combination so that I could calculate the proper shipping amount.

Thanks for any ideas.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Workflow trigger for a particular attribute/option combinati

I actually had a similar requirement, where a product w/ a specific attribute selected had to ship UPS while everything else shipped USPS. I ended up writing a custom workflow-ng condition for it that you may be able to use with some tweaking.

Can't remember if you're into PHP or not, but right now the direct comparison happens in the function uc_order_condition_has_sku(). You need to change the way it calculates $required_check... perhaps instead of using in_array(), try something like:

<?php
  $required_check
= FALSE;
  foreach (
$skus as $sku) {
    if (
strpos($sku, $settings['sku']) !== FALSE) {
     
$required_check = TRUE;
    }
  }
?>

This will allow you to check for partial SKU matches, like using the adjustments to add a suffix to all SKUs that ship a certain way and use this new condition to check for that suffix.

No warranties on this code... you may need to tweak it some to get it to work. Eye-wink

AttachmentSize
uc_morewfng.tar 5 KB
seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
Re: Re: Workflow trigger for a particular attribute/option combi

Thanks, Ryan. Will give this a try right away.

I am not a real php programmer. I can probably find and fix problem code, but I am more dangerous than skillful Eye-wink

alanburke@drupal.org's picture
Offline
Joined: 08/05/2008
Juice: 82
Thanks

Useful little module.
Alan

scottrigby's picture
Offline
Getting busy with the Ubercode.
Joined: 10/08/2007
Juice: 121
Custom PHP workflow_ng condition?

Hi Ryan,
This module is actually what I was referring to here:
http://www.ubercart.org/forum/support/7676/workflow_ng_custom_php_condit...

In that support request, I'm trying to learn how to write a custom PHP workflow condition to check that a particular attribute/option is selected in one or more of the products in an order.

I tried this module, and it's actually really great Smiling It just won't work as well as a custom PHP condition would for my purpose for reasons I outline in the support request link just above.

It would be great to hear if you think this direction makes sense - if you don't mind taking a look?

Cheers Smiling
Scott