Example #1
0
 /**
  * Get the Item object referenced in the Cart->contents()
  *
  * Note the ShippingPackageItem may contain only a portion of the quantity of the referenced Item.
  *
  * @author John Dillick
  * @since 1.2.2
  *
  * @return mixed boolean false if reference doesn't exist, else parent Item object
  **/
 public function parentItem()
 {
     if (false === $this->index) {
         return false;
     }
     return shopp_cart_item($this->index);
 }
Example #2
0
/**
 * Returns the number of addons added to the cartitem.
 *
 * @api
 * 
 * @param $itemkey
 * @return bool|int
 */
function shopp_cart_item_addons_count($itemkey)
{
    if (false === $itemkey) {
        shopp_debug(__FUNCTION__ . " failed: itemkey parameter required.");
        return false;
    }
    if (!($item = shopp_cart_item($itemkey))) {
        shopp_debug(__FUNCTION__ . " failed: no such item {$itemkey}");
        return false;
    }
    if (false === ($addons = shopp_cart_item_addons($itemkey))) {
        return false;
        // Debug message will already have been generated in shopp_cart_item_addons()
    }
    return (int) count($addons);
}
Example #3
0
 /**
  * Provides shippable items to shipping rate calculator modules
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return void
  **/
 private function items()
 {
     foreach ($this->shippable as $id => $free) {
         $CartItem = shopp_cart_item($id);
         if (!$CartItem) {
             continue;
         }
         $Item = new ShoppShippableItem($CartItem);
         $this->item($Item);
         do_action('shopp_calculate_item_shipping', $id, $Item);
     }
 }