Пример #1
0
 /**
  * Checks if the customer has any purchases
  *
  * @api `shopp('customer.has-purchases')`
  * @since 1.1
  *
  * @param string        $result  The output
  * @param array         $options The options
  * - **daysago**: Limit to find orders up to a given number of days from today
  * @param ShoppCustomer $O       The working object
  * @return bool True if purchases are found, false otherwise
  **/
 public static function has_purchases($result, $options, $O)
 {
     $Storefront = ShoppStorefront();
     $filters = array();
     if (isset($options['daysago'])) {
         $filters['where'] = "UNIX_TIMESTAMP(o.created) > UNIX_TIMESTAMP()-" . $options['daysago'] * 86400;
     }
     if (empty($Storefront->purchases)) {
         $O->load_orders($filters);
     }
     reset($Storefront->purchases);
     return !empty($Storefront->purchases);
 }