コード例 #1
0
ファイル: Cart.php プロジェクト: jeffhorus/sepatuku
 static function _combineSimpleFromAggregator($simple, $agg)
 {
     $attrs = array('Weight', 'IsAllowBackorder', 'IsIgnoreStock', 'SomeDummy', 'Label', 'Price', 'SalePrice', 'AdvancedPricingRule');
     $newSimple = NULL;
     if ($simple) {
         $newSimple = clone $simple;
     }
     foreach ($attrs as $attr) {
         $val = Helper_Structure::_getAttrFromObj($attr, $newSimple, $agg);
         $setMethod = 'set' . $attr;
         if (is_callable(array($newSimple, $setMethod))) {
             $newSimple->{$setMethod}($val);
         }
     }
     return $newSimple;
 }
コード例 #2
0
ファイル: Objects.php プロジェクト: jeffhorus/sepatuku
 static function _ecommerceProductToArr($controller, $obj)
 {
     $arr = self::_basicProductToArr($controller, $obj);
     if (!$obj instanceof EcommerceProduct) {
         return $arr;
     }
     $tempSimpleProducts = Helper_Krco::getSimpleProductsByAggregatorId($controller, $obj->getId());
     $simpleProducts = array();
     foreach ($tempSimpleProducts as $simProd) {
         $newSimProd = Helper_Cart::_combineSimpleFromAggregator($simProd, $obj);
         $simpleProducts[] = $newSimProd;
     }
     $arr['decoration'] = $obj->getRibbon();
     $arr['wish_count'] = (int) $obj->getWishCount();
     $arr['options'] = $controller->_getProductOptions($obj);
     $arr['general_options'] = $controller->_getProductGeneralOptions($arr['options']);
     $arr['is_backorder'] = Helper_Structure::_getAttrFromObj('IsAllowBackorder', $obj);
     $arr['variants'] = $controller->_getProductVariants($obj, $simpleProducts);
     $arr['detailed_variants'] = $controller->_getProductVariants($obj, $simpleProducts, TRUE);
     $arr['prices_by_color'] = $controller->_getPricesByColor($obj, $simpleProducts);
     $arr['advanced_pricing_rules'] = json_decode($obj->getAdvancedPricingRule(), TRUE);
     $arr['size'] = $obj->getAttribute1();
     $arr['color'] = $obj->getAttribute2();
     //$arr['material'] = $obj->getAttribute3();
     $options = $controller->getObjKrcoConfig('options', 'products');
     if (is_array($options)) {
         $idx = 3;
         $defKeys = Helper_Krco::getDefaultProductOptionKeys();
         foreach ($options as $key => $opt) {
             if (in_array($key, $defKeys)) {
                 continue;
             }
             $getAttr = "getAttribute{$idx}";
             $arr[$key] = $obj->{$getAttr}();
             $idx++;
         }
     }
     return $arr;
 }