Exemplo n.º 1
0
 def buildSupplierFields(self):
     # ==================================================================== #
     # Safety Check
     if "seller_ids" not in self.getModel().fields_get():
         return
     # ====================================================================#
     # First Supplier Name
     FieldFactory.create(const.__SPL_T_VARCHAR__, "supplier_name",
                         "Supplier Name")
     FieldFactory.microData("http://schema.org/Product", "supplierName")
     FieldFactory.addChoices(
         M2OHelper.get_name_values(SupplierHelper.vendorDomain,
                                   SupplierHelper.filter))
     FieldFactory.isNotTested()
     # ====================================================================#
     # First Supplier Price as Double
     FieldFactory.create(const.__SPL_T_DOUBLE__, "supplier_price_dbl",
                         "Supplier Price (Float)")
     FieldFactory.microData("http://schema.org/Product", "supplierPriceDbl")
     FieldFactory.association("supplier_name")
     # ==================================================================== #
     # First Supplier Price
     FieldFactory.create(const.__SPL_T_PRICE__, "supplier_price",
                         "Supplier Price")
     FieldFactory.microData("http://schema.org/Product", "supplierPrice")
     FieldFactory.isWriteOnly(Framework.isDebugMode())
     FieldFactory.isNotTested()
     # ====================================================================#
     # First Supplier SKU
     FieldFactory.create(const.__SPL_T_VARCHAR__, "supplier_sku",
                         "Supplier SKU")
     FieldFactory.microData("http://schema.org/Product", "mpn")
     FieldFactory.association("supplier_name", "supplier_price_dbl")
     # ====================================================================#
     # First Supplier MOQ
     FieldFactory.create(const.__SPL_T_INT__, "supplier_min_qty",
                         "Supplier MOQ")
     FieldFactory.microData("http://schema.org/Product", "supplierMinQty")
     FieldFactory.association("supplier_name", "supplier_price_dbl")
     # ====================================================================#
     # First Supplier Currency
     FieldFactory.create(const.__SPL_T_CURRENCY__, "supplier_currency",
                         "Supplier Currency")
     FieldFactory.microData("http://schema.org/Product", "supplierCurrency")
     FieldFactory.isNotTested()
Exemplo n.º 2
0
 def buildProductsRelationsFields(self):
     # ==================================================================== #
     # Product Main category
     FieldFactory.create(const.__SPL_T_VARCHAR__, "categ_id",
                         "Categorie Id")
     FieldFactory.microData("http://schema.org/Product", "classificationId")
     FieldFactory.isReadOnly()
     FieldFactory.create(const.__SPL_T_VARCHAR__, "categ", "Categorie")
     FieldFactory.microData("http://schema.org/Product", "classification")
     FieldFactory.addChoices(M2OHelper.get_name_values("product.category"))
     FieldFactory.isNotTested()
     # ==================================================================== #
     # Product Routes
     FieldFactory.create(const.__SPL_T_VARCHAR__, "route_ids", "Routes Ids")
     FieldFactory.microData("http://schema.org/Product", "routesId")
     FieldFactory.isReadOnly()
     FieldFactory.create(const.__SPL_T_VARCHAR__, "routes", "Routes")
     FieldFactory.microData("http://schema.org/Product", "routes")
     FieldFactory.isNotTested()
     allFields = self.getModel().fields_get()
     # ==================================================================== #
     # Website category
     if "public_categ_ids" in allFields:
         FieldFactory.create(const.__SPL_T_VARCHAR__, "public_categ_ids",
                             "Categorie Id")
         FieldFactory.microData("http://schema.org/Product",
                                "publicCategoryId")
         FieldFactory.isReadOnly()
         FieldFactory.create(const.__SPL_T_VARCHAR__, "public_categ",
                             "Public Categorie")
         FieldFactory.microData("http://schema.org/Product",
                                "publicCategory")
         FieldFactory.addChoices(
             M2OHelper.get_name_values("product.public.category"))
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Website Alternate Products
     if "alternative_product_ids" in allFields:
         FieldFactory.create(const.__SPL_T_VARCHAR__,
                             "alternative_products",
                             "Alternate Products Names")
         FieldFactory.microData("http://schema.org/Product",
                                "alternateModels")
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Website Accessory Products
     if "accessory_product_ids" in allFields:
         FieldFactory.create(const.__SPL_T_VARCHAR__, "accessory_products",
                             "Accessory Products Names")
         FieldFactory.microData("http://schema.org/Product",
                                "crossellModels")
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Allowed Companies
     if "ons_allowed_company_ids" in allFields:
         FieldFactory.create(const.__SPL_T_VARCHAR__, "company_ids",
                             "Companies IDs")
         FieldFactory.microData("http://schema.org/Product",
                                "allowedCompanies")
         FieldFactory.isNotTested()
         FieldFactory.create(const.__SPL_T_VARCHAR__, "company_names",
                             "Companies Names")
         FieldFactory.microData("http://schema.org/Product",
                                "allowedCompaniesNames")
         FieldFactory.isNotTested()
     # ==================================================================== #
     # Product Brand
     if "product_brand_id" in allFields:
         FieldFactory.create(const.__SPL_T_VARCHAR__, "product_brand_id",
                             "Brand Id")
         FieldFactory.microData("http://schema.org/Product", "brandId")
         FieldFactory.isReadOnly()
         FieldFactory.create(const.__SPL_T_VARCHAR__, "product_brand",
                             "Brand")
         FieldFactory.microData("http://schema.org/Product", "brand")
         FieldFactory.addChoices(M2OHelper.get_name_values("product.brand"))
         FieldFactory.isNotTested()
     # ==================================================================== #
     # [Point of Sale] POS Category
     if "pos_categ_id" in allFields:
         FieldFactory.create(const.__SPL_T_VARCHAR__, "pos_categ_id",
                             "POS Category Id")
         FieldFactory.microData("http://schema.org/Product",
                                "posCategoryId")
         FieldFactory.isReadOnly()
         FieldFactory.create(const.__SPL_T_VARCHAR__, "pos_categ",
                             "POS Category")
         FieldFactory.microData("http://schema.org/Product", "posCategory")
         FieldFactory.addChoices(M2OHelper.get_name_values("pos.category"))
         FieldFactory.isNotTested()
     # ==================================================================== #
     # [MY LED] Product Tags
     if "tag_ids" in allFields:
         FieldFactory.create(const.__SPL_T_VARCHAR__, "tag_id", "Tag Id")
         FieldFactory.microData("http://schema.org/Product", "tagId")
         FieldFactory.addChoices(M2OHelper.get_name_values("product.tag"))
         FieldFactory.isWriteOnly()
         FieldFactory.isNotTested()
         FieldFactory.create(const.__SPL_T_VARCHAR__, "tag_id", "Tag Ids")
         FieldFactory.microData("http://schema.org/Product", "tagIds")
         FieldFactory.addChoices(M2OHelper.get_name_values("product.tag"))
         FieldFactory.isNotTested()