GET /admin/products/:id/variants/json
173616
def admin_variants_json
      render :json => false if !user_is_allowed('products', 'edit')    
      p = Product.find(params[:id])
      render :json => p.variants
    end
475404
def admin_update
      return if !user_is_allowed('products', 'edit')
      
      resp = Caboose::StdClass.new({'attributes' => {}})
      product = Product.find(params[:id])    
      
      save = true    
      params.each do |name,value|
        case name
          when 'alternate_id'
            product.alternate_id = value
          when 'date_available'
            if value.strip.length == 0
              product.date_available = nil
            else
              begin
                product.date_available = DateTime.parse(value)
              rescue
                resp.error = "Invalid date"
                save = false
              end
            end
          when 'title'
            product.title = value
          when 'caption'
            product.caption = value
          when 'featured'
            product.featured = value
          when 'description'
            product.description = value
          when 'category_id'
            product.category_id = value
          when 'vendor_id'  
            product.vendor_id = value
          when 'handle'
            product.handle = value
          when 'seo_title'
            product.seo_title = value
          when 'seo_description'
            product.seo_description = value
          when 'option1'
            product.option1 = value
          when 'option2'
            product.option2 = value
          when 'option3'
            product.option3 = value
          when 'default1'
            product.default1 = value
            Variant.where(:product_id => product.id, :option1 => nil).each do |p|
              p.option1 = value
              p.save
            end
          when 'default2'
            product.default2 = value
            Variant.where(:product_id => product.id, :option2 => nil).each do |p|
              p.option2 = value
              p.save
            end
          when 'default3'
            product.default3 = value
            Variant.where(:product_id => product.id, :option3 => nil).each do |p|
              p.option3 = value
              p.save
            end
          when 'status'
            product.status = value
        end
      end
      resp.success = save && product.save
      render :json => resp
    end
653872
def _get_products(self):
        
        '''  '''
    
    # request product list
        products_request = self.account_products()
        if products_request['error']:
            raise Exception(products_request['error'])

    # construct list of product ids
        product_ids = []
        for product in products_request["json"]["entries"]:
            product_ids.append(product['productId'])
    
    # construct default product map
        self.products = {}
    
    # request product details
        for id in product_ids:
            product_request = self.account_product(id)
            if product_request['error']:
                raise Exception(product_request['error'])
            self.products[id] = product_request['json']

        return self.products
194036
def update_product(product_id, **kwargs):
    
    content = update_product_raw(product_id, **kwargs)
    if content:
        return utils.format_json(content)
419748
function get(id, store) {
      var data = store.rootData.asObject();
      // Get item from data object
      return data[id]
        ? data[id]
        : vcomet.error.log("store", "Item with id " + id + " not found");
    }
633810
def admin_edit
      return if !user_is_allowed('products', 'edit')
      @product = Product.find(params[:product_id])
      @modification = Modification.find(params[:mod_id])
      @modification_value_input_field = ModificationValueInputField.find(params[:id])
      render :layout => 'caboose/modal'
    end
509306
def get_products(self, product_ids):
        
        if self.product_set_id is None:
            raise ValueError('product_set_id must be specified')
        data = {'ids': product_ids}
        return self.client.get(self.base_url + '/products', json=data)
1200204
def fetch_by_id(model, id, filters = {})
      get_resource("/v1/public/#{model}/#{id}", filters) if model_exists?(model) && validate_filters(filters)
    end
33046
def as_json(_options = {})
      {
        resource_owner_id: resource_owner_id,
        scope: scopes,
        expires_in: expires_in_seconds,
        application: { uid: application.try(:uid) },
        created_at: created_at.to_i,
      }
    end
596246
public function getProductVariationJsonData()
    {
        $jsonData = [];
        $lists = ProductAttributeIntegerValue::whereIn(
            'product_id',
            $this->productVariations->pluck('variation_id')
        )->get();
        
        foreach ($lists as $list) {
            $variationModel = self::find($list->product_id);
            if (array_has($jsonData, $list->product_id)) {
                $data = array_get($jsonData, $list->product_id);
                $data[$list->attribute_id] = [
                    $list->value => ['qty' => $variationModel->qty, 'price' => $variationModel->price]
                ];
                $jsonData[$list->product_id] = $data;
            } else {
                $jsonData[$list->product_id] = [$list->attribute_id => [
                    $list->value => ['qty' => $variationModel->qty, 'price' => $variationModel->price]]
                ];
            }
        }
        return $jsonData;
    }
646403
def list_build_configurations_for_product(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    
    data = list_build_configurations_for_product_raw(id, name, page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)
541359
def get_product(config):
    
    product_url = config['keeper_url'] + '/products/{p}'.format(
        p=config['ltd_product'])
    r = requests.get(product_url)
    if r.status_code != 200:
        raise RuntimeError(r.json())
    product_info = r.json()
    return product_info
245058
def admin_index   
      return if !user_is_allowed('products', 'edit')    
      @product = Product.find(params[:product_id])
      
      if @product.variants.nil? || @product.variants.count == 0
        v = Variant.new
        v.product_id = @product.id
        v.option1 = @product.default1 if @product.option1
        v.option2 = @product.default2 if @product.option2
        v.option3 = @product.default3 if @product.option3
        v.status  = 'Active'
        v.save        
      end
      @variant = params[:variant_id] ? Variant.find(params[:variant_id]) : @product.variants[0]
      @highlight_variant_id = params[:highlight] ? params[:highlight].to_i : nil
      render :layout => 'caboose/admin'                
    end
1077513
public function item($id){
		$geo = Geo::find($id);
		$this->applyFilter($geo);
		return \Response::json($geo);
	}
1177877
def get(self, param=None, must=[APIKEY]):
        '''
        '''
        param = {} if param is None else param
        r = self.verify_param(param, must)
        if not r.is_succ():
            return r
        handle = CommonResultHandler(lambda rsp: {VERSION_V1:rsp.get(USER), VERSION_V2:rsp}[self.version()])
        return self.path('get.json').post(param, handle, r)
723576
def find_by_id(self, organization_export, params={}, **options): 
        
        path = "/organization_exports/%s" % (organization_export)
        return self.client.get(path, params, **options)
635438
public function getAction(Request $request, $parentId, $variantId)
    {
        $locale = $this->getLocale($request);
        $view = $this->responseGetById(
            $variantId,
            function ($id) use ($locale, $parentId) {
                $product = $this->getProductManager()->findByIdAndLocale($id, $locale);

                if ($product !== null && $product->getParent() && $product->getParent()->getId() == $parentId) {
                    return $product;
                } else {
                    return null;
                }
            }
        );

        return $this->handleView($view);
    }