Give_Donate_Form::increase_sales PHP Method

increase_sales() public method

Increment the sale count by one
Since: 1.0
public increase_sales ( integer $quantity = 1 ) : integer | false
$quantity integer The quantity to increase the donations by. Default is 1.
return integer | false New number of total sales.
    public function increase_sales($quantity = 1)
    {
        $sales = give_get_form_sales_stats($this->ID);
        $quantity = absint($quantity);
        $total_sales = $sales + $quantity;
        if ($this->update_meta('_give_form_sales', $total_sales)) {
            $this->sales = $total_sales;
            return $this->sales;
        }
        return false;
    }

Usage Example

Exemplo n.º 1
0
/**
 *
 * Increases the sale count of a download.
 *
 * @since 1.0
 *
 * @param int $give_form_id Give Form ID
 *
 * @return bool|int
 */
function give_increase_purchase_count($give_form_id = 0)
{
    $form = new Give_Donate_Form($give_form_id);
    return $form->increase_sales();
}
All Usage Examples Of Give_Donate_Form::increase_sales