当前位置: 首页>>代码示例>>PHP>>正文


PHP Products::SetFieldsById方法代码示例

本文整理汇总了PHP中Products::SetFieldsById方法的典型用法代码示例。如果您正苦于以下问题:PHP Products::SetFieldsById方法的具体用法?PHP Products::SetFieldsById怎么用?PHP Products::SetFieldsById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products的用法示例。


在下文中一共展示了Products::SetFieldsById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unset

         $tempmanager = $managers_list[array_rand($managers_list)];
     }
 }
 // Выбор доступных городов, если у пользователя была сохранена область
 if (isset($saved['city'])) {
     $cities_list = $Cities->SetFieldsByInput($saved['city']['region']);
     if (!$Deliveryservice->SetFieldsByInput($saved['city']['name'], $saved['city']['region'])) {
         unset($deliverymethods_list[3]);
     }
     $Deliveryservice->SetListByRegion($saved['city']['names_regions']);
     $deliveryservices_list = $Deliveryservice->list;
     $Delivery->SetFieldsByInput($saved['city']['shipping_comp'], $saved['city']['name'], $saved['city']['region']);
     $deliverydepartments_list = $Delivery->list;
 }
 if (isset($_SESSION['cart']['id_gift'])) {
     $Products->SetFieldsById($_SESSION['cart']['id_gift']);
     $Products->fields['images'] = $Products->GetPhotoById($Products->fields['id_product']);
     $tpl->Assign('gift', $Products->fields);
 }
 /* output data */
 $tpl->Assign('customer', $customer);
 $tpl->Assign('regions_list', $regions_list);
 $tpl->Assign('deliverymethods_list', $deliverymethods_list);
 $tpl->Assign('cities_list', $cities_list);
 $tpl->Assign('deliveryservices_list', $deliveryservices_list);
 $tpl->Assign('deliverydepartments_list', $deliverydepartments_list);
 $tpl->Assign('managers_list', $managers_list);
 $tpl->Assign('saved', $saved);
 $tpl->Assign('personal_discount', isset($_SESSION['cart']) && isset($_SESSION['cart']['personal_discount']) ? $_SESSION['cart']['personal_discount'] : 1);
 /* Действия */
 if (isset($GLOBALS['Rewrite']) && is_numeric($GLOBALS['Rewrite'])) {
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:cart.php

示例2: UpdateCartQty

 public function UpdateCartQty($data)
 {
     $Products = new Products();
     $Products->SetFieldsById($data['id_product'], 0);
     $product = $Products->fields;
     if ($product['price_mopt'] == 0) {
         $product['min_mopt_qty'] = $product['inbox_qty'];
     }
     $quantity = $data['quantity'];
     $note = isset($data['note']) ? $data['note'] : (isset($data['note_opt']) && !empty($data['note_opt']) ? $data['note_opt'] : (isset($data['note_mopt']) && !empty($data['note_mopt']) ? $data['note_mopt'] : ''));
     if (isset($data['button']) && $data['button']) {
         if ($data['direction'] == 1) {
             if ($product['qty_control'] == 1 && fmod($quantity, $product['min_mopt_qty']) != 0) {
                 $quantity = $product['min_mopt_qty'] * ceil($quantity / $product['min_mopt_qty']);
             }
             if ($quantity < $product['min_mopt_qty']) {
                 $quantity = $product['min_mopt_qty'];
             }
         } else {
             if ($product['qty_control'] == 1 && fmod($quantity, $product['min_mopt_qty']) != 0) {
                 $quantity = $product['min_mopt_qty'] * floor($quantity / $product['min_mopt_qty']);
             }
             if ($quantity < $product['min_mopt_qty']) {
                 $quantity = 0;
             }
         }
     } else {
         if ($quantity > 0) {
             if ($product['qty_control'] == 1 && fmod($quantity, $product['min_mopt_qty']) != 0) {
                 $quantity = $product['min_mopt_qty'] * round($quantity / $product['min_mopt_qty']);
             }
             if ($quantity < $product['min_mopt_qty']) {
                 $quantity = $product['min_mopt_qty'];
             }
         }
     }
     $quantity = $quantity > $product['min_mopt_qty'] ? $quantity : $product['min_mopt_qty'];
     if ($quantity < $product['inbox_qty'] || $product['price_opt'] == 0) {
         $mode = 'mopt';
         $other_mode = 'opt';
     } else {
         $mode = 'opt';
         $other_mode = 'mopt';
     }
     $base_price = $product['price_' . $mode];
     // Заполнение массива основных цен и суммы товара
     foreach ($correction_set = explode(';', $GLOBALS['CONFIG']['correction_set_' . $product[$mode . '_correction_set']]) as $cs) {
         $summary[] = round(round($cs * $base_price, 2) * $quantity, 2);
         $actual_prices[] = round($cs * $base_price, 2);
     }
     // Заполнение массива дополнительных цен
     foreach (explode(';', $GLOBALS['CONFIG']['correction_set_' . $product[$other_mode . '_correction_set']]) as $cs) {
         $other_prices[] = round($cs * $product['price_' . $other_mode], 2);
     }
     if ($quantity > 0) {
         $_SESSION['cart']['products'][$product['id_product']]['quantity'] = $product['quantity'] = $quantity;
         $_SESSION['cart']['products'][$product['id_product']]['mode'] = $mode;
         $_SESSION['cart']['products'][$product['id_product']]['summary'] = $summary;
         $_SESSION['cart']['products'][$product['id_product']]['base_price'] = $base_price;
         $_SESSION['cart']['products'][$product['id_product']]['actual_prices'] = $product['actual_prices'] = $actual_prices;
         $_SESSION['cart']['products'][$product['id_product']]['other_prices'] = $product['other_prices'] = $other_prices;
         $_SESSION['cart']['products'][$product['id_product']]['correction_set'] = $correction_set;
         $_SESSION['cart']['products'][$product['id_product']]['note'] = $note;
         if (isset($data['id_cart_product'])) {
             $_SESSION['cart']['products'][$product['id_product']]['id_cart_product'] = $data['id_cart_product'];
         }
     } else {
         if (isset($_SESSION['cart']['products'][$product['id_product']]['id_cart_product'])) {
             $this->db->StartTrans();
             $this->db->DeleteRowFrom(_DB_PREFIX_ . "cart_product", "id_cart_product", $_SESSION['cart']['products'][$product['id_product']]['id_cart_product']);
             $this->db->CompleteTrans();
         }
         unset($_SESSION['cart']['products'][$product['id_product']]);
         $product['quantity'] = $quantity;
         $product['actual_prices'] = $actual_prices;
         $product['other_prices'] = $other_prices;
     }
     // if($quantity > $product['product_limit']){
     // 	$_SESSION['cart']['products'][$product['id_product']]['error_limit'] = true;
     // }
     $this->RecalcCart();
     return array('cart' => $_SESSION['cart'], 'product' => $product);
 }
开发者ID:Arikito,项目名称:webking.xt,代码行数:83,代码来源:cart_c.php

示例3: Suppliers

// список всех менеджеров
$Contragents->SetList();
$tpl->Assign('managers_list', $Contragents->list);
if (!isset($_SESSION['member']['promo_code']) || $_SESSION['member']['promo_code'] == '') {
    $Contragents->GetSavedFields($Customers->fields['id_contragent']);
    $tpl->Assign('SavedContragent', $Contragents->fields);
} else {
    $Suppliers = new Suppliers();
    $Suppliers->GetSupplierIdByPromoCode($_SESSION['member']['promo_code']);
    $tpl->Assign('promo_supplier', $Suppliers->fields);
    unset($Suppliers);
}
// Выборка просмотренных товаров
if (isset($_COOKIE['view_products'])) {
    foreach (json_decode($_COOKIE['view_products']) as $value) {
        $Products->SetFieldsById($value, 1, 1);
        $product = $Products->fields;
        if (isset($product['id_product']) && $product['id_product'] != '') {
            $product['images'] = $Products->GetPhotoById($product['id_product']);
        }
        $result[] = $product;
    }
    $tpl->Assign('view_products_list', array_reverse($result));
    unset($result, $product, $value);
}
// Обработка сортировок ====================================
if (isset($_COOKIE['sorting'])) {
    $sort = (array) json_decode($_COOKIE['sorting'], true);
}
if (isset($GLOBALS['Sort'])) {
    $sort_value = $GLOBALS['Sort'];
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:index.php

示例4: Products

<?if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'){
	header('Content-Type: text/javascript; charset=utf-8');
	$Products = new Products();
	$Customer = new Customers();
	$User = new Users();
	$User->SetUser(isset($_SESSION['member'])?$_SESSION['member']:null);
	if(isset($_POST['action']))
		switch($_POST['action']){
			case "get_array_product":
				$Products->SetFieldsById($_POST['id_product']);
				$prod = $Products->fields;
				$prod['images'] = $Products->GetPhotoById($prod['id_product']);
				$rating_stars = '';
				for($i = 1; $i <= 5; $i++){
					$star = 'star';
					if($i > floor($prod['c_rating'])){
						if($i == ceil($prod['c_rating'])){
							$star .= '_half';
						}else{
							$star .= '_outline';
						}
					}
					$rating_stars .= '<li><span class="icon-font">'.$star.'</span></li>';
				}
				$rating_title = ($prod['c_rating'] != '')?'Рейтинг: '.round($prod['c_rating'],2):'Нет оценок';
				$comments_count = $prod['c_count'];
				if($prod['c_count'] == 1){
					$comments_count .= ' отзыв';
				}elseif(substr($prod['c_count'], -1) == 1 && substr($prod['c_count'], -2, 1) != 1){
					$comments_count .= ' отзыв';
				}elseif(substr($prod['c_count'], -1) == 2 || substr($prod['c_count'], -1) == 3 || substr($prod['c_count'], -1) == 4 && substr($prod['c_count'], -2, 1) != 1){
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:ajaxproduct.php

示例5: header

                header('Location: ' . $GLOBALS['URL_base'] . 'adm/productadd/');
                exit;
            }
            header('Location: ' . $GLOBALS['URL_base'] . 'adm/productedit/' . $id_product);
            unset($_POST);
        } else {
            $tpl->Assign('msg', 'Товар не обновлен.');
            $tpl->Assign('errm', $errm);
        }
    } else {
        // показываем все заново но с сообщениями об ошибках
        $tpl->Assign('msg', 'Товар не обновлен2.');
        $tpl->Assign('errm', $errm);
    }
}
if (!$Products->SetFieldsById($id_product, 0)) {
    die('Ошибка при выборе товара.');
}
// Формирование списка категорий для выпадающего списка
$list = $Products->generateCategory();
// Определение категории к которой принадлежит товар
if (isset($item['id_category']) && $item['id_category'] == $Products->fields['id_category']) {
    $category['name'] = $item['name'];
    $category['id_category'] = $item['id_category'];
}
$tpl->Assign('list', $list);
// get last article
$tpl->Assign('last_article', $Products->GetLastArticle());
//Дубликат товара
if (isset($_POST['smb_duplicate'])) {
    if ($id = $Products->DuplicateProduct($_POST)) {
开发者ID:Arikito,项目名称:webking.xt,代码行数:31,代码来源:photo_productsedit.php


注:本文中的Products::SetFieldsById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。