Exemple #1
0
 /**
  * Updates the featured setting of a set of products
  *
  * @author Jonathan Davis
  * @since 1.2
  *
  * @param array $ids Set of product IDs to update
  * @param string $setting Either 'on' or 'off'
  * @return boolean
  **/
 static function featureset($ids, $setting)
 {
     if (empty($ids) || !is_array($ids)) {
         return false;
     }
     $settings = array('on', 'off');
     if (!in_array($setting, $settings)) {
         return false;
     }
     foreach ($ids as $id) {
         $Product = new ProductSummary((int) $id);
         $Product->featured = $setting;
         $Product->save();
     }
     return true;
 }
Exemple #2
0
 public function feature_product()
 {
     check_admin_referer('wp_ajax_shopp_feature_product');
     if (empty($_GET['feature'])) {
         die('0');
     }
     $Product = new ProductSummary((int) $_GET['feature']);
     if (empty($Product->product)) {
         die('0');
     }
     $Product->featured = 'on' == $Product->featured ? 'off' : 'on';
     $Product->save();
     echo $Product->featured;
     exit;
 }