Пример #1
0
 public static function getDetails()
 {
     $details = parent::getDetails();
     $additionalDetails = array(array('id' => 'listing_type_sid', 'caption' => 'Listing Type', 'type' => 'list', 'list_values' => SJB_ListingTypeManager::getListingAllTypesForListType(), 'length' => '20', 'table_name' => 'products', 'is_required' => true, 'is_system' => true, 'order' => 1), array('id' => 'listing_duration', 'caption' => 'Listing Duration (days)', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 2), array('id' => 'featured', 'caption' => 'Featured', 'type' => 'boolean', 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 3), array('id' => 'featured_period', 'caption' => 'Featured period', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 4), array('id' => 'priority', 'caption' => 'Priority', 'type' => 'boolean', 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 5), array('id' => 'priority_period', 'caption' => 'Priority period', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 6), array('id' => 'number_of_pictures', 'caption' => 'Number of pictures', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 7), array('id' => 'video', 'caption' => 'Video', 'type' => 'boolean', 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 8), array('id' => 'price', 'caption' => 'Price', 'type' => 'float', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'number_of_listings', 'caption' => 'Number of Listings', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'comment' => 'Leave empty or 0 for unlimited posting', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 2), array('id' => 'renewal_price', 'caption' => 'Renewal Price (per listing)', 'type' => 'float', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 3), array('id' => 'upgrade_to_featured_listing_price', 'caption' => 'Upgrade to Featured Listing Price', 'type' => 'float', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 7), array('id' => 'upgrade_to_priority_listing_price', 'caption' => 'Upgrade to Priority Listing Price', 'type' => 'float', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 8), array('id' => 'expiration_period', 'caption' => 'Product Expiration', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'comment' => 'Set empty or zero for never expire', 'is_required' => false, 'is_system' => true, 'order' => 1));
     $details = array_merge($details, $additionalDetails);
     return $details;
 }
Пример #2
0
 public static function getDetails()
 {
     $details = parent::getDetails();
     $additionalDetails = array(array('id' => 'recurring', 'caption' => '', 'type' => 'list', 'length' => '20', 'list_values' => array(array('id' => '0', 'caption' => 'One-time payment'), array('id' => '1', 'caption' => 'Recurring Subscription')), 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 0), array('id' => 'price', 'caption' => 'Price', 'type' => 'float', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'period', 'caption' => 'Period', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => true, 'is_system' => true, 'order' => 2), array('id' => 'period_name', 'caption' => 'Period', 'type' => 'list', 'length' => '20', 'list_values' => array(array('id' => 'unlimited', 'caption' => 'Unlimited'), array('id' => 'week', 'caption' => 'Week(s)'), array('id' => 'month', 'caption' => 'Month(s)'), array('id' => 'year', 'caption' => 'Year(s)')), 'table_name' => 'products', 'is_required' => true, 'is_system' => true, 'order' => 3));
     $details = array_merge($details, $additionalDetails);
     return $details;
 }
Пример #3
0
 public static function saveProduct($product)
 {
     $productType = $product->getProductType();
     if (!is_null($productType)) {
         $generalDetails = SJB_ProductDetails::getDetails();
         $generalDetailsIDs = array('product_type');
         foreach ($generalDetails as $generalDetail) {
             $generalDetailsIDs[] = $generalDetail['id'];
         }
         $serializedDetails = array();
         $product->setFloatNumbersIntoValidFormat();
         $properties = $product->getProperties();
         foreach ($properties as $name => $property) {
             if (!in_array($name, $generalDetailsIDs)) {
                 $serializedDetails[$name] = $product->getPropertyValue($name);
                 $product->deleteProperty($name);
             }
         }
         $product->addProperty(array('id' => 'serialized_extra_info', 'type' => 'text', 'value' => serialize($serializedDetails), 'is_system' => true));
         $productSID = $product->getSID();
         SJB_ObjectDBManager::saveObject('products', $product);
         if (!$productSID) {
             $max_order = SJB_DB::queryValue("SELECT MAX(`order`) FROM `products` WHERE `user_group_sid`=?n", $product->getPropertyValue('user_group_sid'));
             $max_order = empty($max_order) ? 1 : $max_order;
             SJB_DB::query("UPDATE `products` SET `order` = ?n WHERE `sid` = ?n", ++$max_order, $product->getSID());
         }
     }
 }
Пример #4
0
 public static function getDetails()
 {
     $bannersObj = new SJB_Banners();
     $bannerGroups = $bannersObj->getAllBannerGroups();
     $bannersList = array();
     foreach ($bannerGroups as $bannerGroup) {
         $bannersList[] = array('id' => $bannerGroup['sid'], 'caption' => $bannerGroup['id']);
     }
     $details = parent::getDetails();
     $additionalDetails = array(array('id' => 'approve_by_admin', 'caption' => 'Approve Banners by Admin', 'type' => 'boolean', 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 7.5), array('id' => 'banner_group_sid', 'caption' => 'Banner Group', 'type' => 'list', 'length' => '20', 'list_values' => $bannersList, 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 0), array('id' => 'width', 'caption' => 'Required Width', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'height', 'caption' => 'Required Height', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 2), array('id' => 'recurring', 'caption' => '', 'type' => 'list', 'length' => '20', 'list_values' => array(array('id' => '0', 'caption' => 'One-time payment'), array('id' => '1', 'caption' => 'Recurring Subscription')), 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 0), array('id' => 'price', 'caption' => 'Price', 'type' => 'float', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'period', 'caption' => 'Period', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => true, 'is_system' => true, 'order' => 2), array('id' => 'period_name', 'caption' => 'Period', 'type' => 'list', 'length' => '20', 'list_values' => array(array('id' => 'unlimited', 'caption' => 'Unlimited'), array('id' => 'week', 'caption' => 'Week(s)'), array('id' => 'month', 'caption' => 'Month(s)'), array('id' => 'year', 'caption' => 'Year(s)')), 'table_name' => 'products', 'is_required' => true, 'is_system' => true, 'order' => 3));
     $details = array_merge($details, $additionalDetails);
     return $details;
 }