Beispiel #1
0
 public function delete_purchased()
 {
     if (empty($this->purchased)) {
         $this->load_purchased();
     }
     foreach ($this->purchased as $item) {
         $Purchased = new ShoppPurchased();
         $Purchased->populate($item);
         $Purchased->delete();
     }
 }
Beispiel #2
0
/**
 * shopp_rmv_order_line_data - remove all or one data key=>value pair from the order line data array
 *
 * @api
 * @since 1.2
 *
 * @param int $order (required) the order id
 * @param int $line (required) the order line item
 * @param string $name (optional default:false) the key to remove, removes all data when false
 * @return bool true on success, false on failure
 **/
function shopp_rmv_order_line_data($order = false, $line = 0, $name = false)
{
    $Lines = shopp_order_lines($order);
    if (empty($Lines) || $line >= count($Lines) || !isset($Lines[$line])) {
        return false;
    }
    $Purchased = new ShoppPurchased();
    $Purchased->populate($Lines[$line]);
    if (!is_array($Purchased->data)) {
        $Purchased->data = array();
    }
    if ($name && in_array($name, array_keys($Purchased->data))) {
        unset($Purchased->data[$name]);
    }
    $Purchased->save();
}