Workflow trigger for a particular attribute/option combination?

Posts: 60
Joined: 11/27/2007

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.

Posts: 5245
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

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.tar5 KB
Posts: 60
Joined: 11/27/2007

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

Posts: 18
Joined: 08/05/2008

Useful little module.
Alan