public function delete($product_id, array $options = array())
    {
        $result = null;
        $this->hook->attach('sku.delete.before', $product_id, $options, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $sql = 'DELETE FROM product_sku WHERE product_id=?';

        if (!empty($options['combinations'])) {
            $sql .= ' AND LENGTH(combination_id) > 0';
        }

        if (!empty($options['base'])) {
            $sql .= ' AND LENGTH(combination_id) = 0';
        }

        $result = (bool) $this->db->run($sql, array($product_id))->rowCount();
        $this->hook->attach('sku.delete.after', $product_id, $options, $result, $this);
        return (bool) $result;
    }
public function delete($product_id, array $options = array())
    {
        $result = null;
        $this->hook->attach('sku.delete.before', $product_id, $options, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $sql = 'DELETE FROM product_sku WHERE product_id=?';

        if (!empty($options['combinations'])) {
            $sql .= ' AND LENGTH(combination_id) > 0';
        }

        if (!empty($options['base'])) {
            $sql .= ' AND LENGTH(combination_id) = 0';
        }

        $result = (bool) $this->db->run($sql, array($product_id))->rowCount();
        $this->hook->attach('sku.delete.after', $product_id, $options, $result, $this);
        return (bool) $result;
    }
public function delete ( $ product_id , array $ options = array ( ) ) { $ result = null ; $ this -> hook -> attach ( 'sku.delete.before' , $ product_id , $ options , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( bool ) $ result ; } $ sql = 'DELETE FROM product_sku WHERE product_id=?' ; if ( ! empty ( $ options [ 'combinations' ] ) ) { $ sql .= ' AND LENGTH(combination_id) > 0' ; } if ( ! empty ( $ options [ 'base' ] ) ) { $ sql .= ' AND LENGTH(combination_id) = 0' ; } $ result = ( bool ) $ this -> db -> run ( $ sql , array ( $ product_id ) ) -> rowCount ( ) ; $ this -> hook -> attach ( 'sku.delete.after' , $ product_id , $ options , $ result , $ this ) ; return ( bool ) $ result ; }
Deletes a product SKU
@param integer $product_id
@param array $options
@todo Refactor
@return boolean
Deletes a product SKU