8 replies [Last post]
Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Was this information Helpful?

Any solutions for this In Store Pickup error? When In Store is activated this error occurs when selecting the In Store option. If flat rate is selected the purchase is completed. With In Store the purchase stops as there is no way to clear the error. Seems that it is looking for something that can not be found - thus the error.

* warning: call_user_func(): First argument is expected to be a valid callback in C:\apache2triad\htdocs\drupal_5.2\modules\shipping\uc_quote\uc_quote.module on line 875.
    * Invalid option selected. Recalculate shipping quotes to continue.

Any solutions?

Jim

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: In Store Pickup Warning

What version of Übercart are you using? If it's the Bazaar version, all the shipping method modules need to integrate Workflow-ng like flatrate or UPS does. If not, I still don't know what's wrong. What's on line 875 of uc_quote.module?

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Error Corde

Using Drupal 5.2 and Uber 7E as localhost. On the live site Drupal 7.3 and Uber 7E. And the same for a second live site. All 3 have the same issue with the In Store warning. With In Store not selected as a module, the site works fine.

With In Store in place and the Local Pick radio button checked the warning appears and you can not go any farther in the check out process. If the flat rate radio button is checked the order is fully processed.

$method = $methods[$quote_option[0]];
      $quote_data = array();
      ob_start();
      $quote_data[$method['id']] = call_user_func($method['quote']['callback'], $products, $details);
      $messages = ob_get_contents();
      ob_end_clean();
      if ($messages && variable_get('uc_quote_log_errors', false)){
        watchdog('quote', $messages, WATCHDOG_WARNING);
      }
      if (!isset($quote_data[$quote_option[0]][$quote_option[1]])){
        drupal_set_message(t('Invalid option selected. Recalculate shipping quotes to continue.'), 'error');
        return false;

Appreciate the look as this is a nice feature that has a lot of positive applications once the callback issue is resolved.

Jim

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Found it! The return value

Found it!

The return value of uc_storepickup_quote() is wrong. The keys of that array need to match the keys of the 'accessorials' array in uc_storepickup_shipping_method(). Either change the return value to array(0 => array(...)), or the accessorials to array('pickup' => t('Shipping Rate')) and it should work.

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Code Changes

Lyle:

Found this bit of code in uc_storepickup.module and assume this is the correct location for the change. Played around with a number of mods, but most end up with a blank screen. Knowing more PHP would be a enhancement on my end.

function uc_storepickup_shipping_method(){
   $methods = array();

  $enabled = variable_get('uc_quote_enabled', array('storepickup' => true));
  $weight = variable_get('uc_quote_method_weight', array('storepickup' => 0));
  $methods['storepickup'] = array(
    'id' => 'storepickup',
    'module' => 'uc_storepickup',
    'title' => t('In-store Pickup'),
    'enabled' => $enabled['storepickup'],
    'quote' => array(
      'type' => 'small_package',
      'callback' => 'uc_storepickup_quote',
  'accessorials' => array( t('Shipping Rate'), ),
     ), 
    'ship' => array(
      'type' => 'customer_pickup',
      'callback' => '',
    ),
    'weight' => $weight['customer_pickup'],
  );
 
  return $methods;
}

Did replace the accessorials with the following.

'accessorials' => array('pickup' => t('Shipping Rate')) 

Not much of a PHP person so there are most likly a number of errors in that substitution. Let me know what needs to be changed where that change should occur. Also did not locate the place where return value to the array could be changed. Again, PHP is just not my cup of tea but fun to play with when it works!!!

Jim

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
Page Code

Notice the following code from the rendered page when using In Store Pickup.

<input name="rate[storepickup---pickup]" value="0.00" type="hidden"><input name="quote-form" value="" type="hidden">
<label class="option"><input class="form-radio" name="quote-option" value="storepickup---pickup" type="radio"><input name="quote-form" value="" type="hidden">
Shipping Rate (Please allow 24 hours): $0.00</label>

Jim

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Code Changes

Yeah, Jim, that's the change that needed to be made. It was an either/or situation, so changing the accessorials means you shouldn't change the return value.

Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1433
New Bug

See the new bug in the In Store Pickup module.

http://ubercart.org/forum/bug_reports/1640/store_country_bug

Or maybe this is just a feature!!!!

Jim

gregmac's picture
Offline
Getting busy with the Ubercode.
Joined: 09/25/2007
Juice: 87
Re: Found it! The return value

Thanks, Lyle. I've updated the module, and I'll upload the new version shortly.