示例#1
0
 def getStartupDirectoryForCategories(self):
     """
     """
     shop = IShopManagement(self).getShop()
     shop_path = "/".join(shop.getPhysicalPath())
     
     return shop_path
示例#2
0
    def getStartupDirectoryForCategories(self):
        """
        """
        shop = IShopManagement(self).getShop()
        shop_path = "/".join(shop.getPhysicalPath())

        return shop_path
示例#3
0
    def getAllProducts(self, **kargs):
        """
        """
        shop = IShopManagement(self.context).getShop()
        catalog = getToolByName(self.context, "portal_catalog")
        brains = catalog.searchResults(path="/".join(shop.getPhysicalPath()),
                                       portal_type="Product",
                                       sort_on="sortable_title")

        # TODO: This is ugly!
        result = []
        for brain in brains:
            result.append(brain.getObject())
        return result
示例#4
0
    def _getGroupsAsDL(self):
        """Returns all Categories as DisplayList
        """
        shop = IShopManagement(self).getShop()

        dl = DisplayList()
        catalog = getToolByName(self, "portal_catalog")

        brains = catalog.searchResults(path="/".join(shop.getPhysicalPath()),
                                       portal_type="ProductGroup")

        for brain in brains:
            dl.add(brain.id, brain.Title)

        return dl
示例#5
0
    def _getGroupsAsDL(self):
        """Returns all Categories as DisplayList
        """
        shop = IShopManagement(self).getShop()

        dl = DisplayList()
        catalog = getToolByName(self, "portal_catalog")

        brains = catalog.searchResults(
            path = "/".join(shop.getPhysicalPath()),
            portal_type="ProductGroup")
            
        for brain in brains:
            dl.add(brain.id, brain.Title)

        return dl
示例#6
0
文件: product.py 项目: viona/Easyshop
    def getStartupDirectoryForGroups(self):
        """
        """
        shop = IShopManagement(self).getShop()
        shop_path = "/".join(shop.getPhysicalPath())

        catalog = getToolByName(self, "portal_catalog")
        brains = catalog.searchResults(
            path=shop_path,
            object_provides="easyshop.core.interfaces.groups.IGroupsContainer")

        if len(brains) > 0:
            products_folder = brains[0]
            return products_folder.getPath()
        else:
            return shop_path
示例#7
0
 def getAllProducts(self, **kargs):
     """
     """
     shop = IShopManagement(self.context).getShop()
     catalog = getToolByName(self.context, "portal_catalog")
     brains = catalog.searchResults(
         path = "/".join(shop.getPhysicalPath()),
         portal_type = "Product",
         sort_on = "sortable_title"
     )
     
     # TODO: This is ugly!
     result = []
     for brain in brains:
         result.append(brain.getObject())
     return result
示例#8
0
    def getCategoriesAsDL(self):
        """Returns all Categories as DisplayList
        """
        shop = IShopManagement(self).getShop()
        
        dl = DisplayList()
        catalog = getToolByName(self, "portal_catalog")
        
        brains = catalog.searchResults(
            path = "/".join(shop.getPhysicalPath()),
            portal_type="Category",
        )

        for brain in brains:
            dl.add(brain.getPath(), "%s (%s)" % (brain.Title, brain.getPath()))
            
        return dl
示例#9
0
 def getStartupDirectoryForGroups(self):
     """
     """
     shop = IShopManagement(self).getShop()
     shop_path = "/".join(shop.getPhysicalPath())
     
     catalog = getToolByName(self, "portal_catalog")
     brains = catalog.searchResults(
         path = shop_path,
         object_provides = "easyshop.core.interfaces.groups.IGroupsContainer"
     )
     
     if len(brains) > 0:
         products_folder = brains[0]
         return products_folder.getPath()
     else:
         return shop_path
示例#10
0
文件: product.py 项目: viona/Easyshop
    def getStartupDirectoryForProducts(self):
        """
        """
        shop = IShopManagement(self).getShop()
        shop_path = "/".join(shop.getPhysicalPath())
        site_url = getToolByName(self, "portal_url")
        portal_path = site_url.getPortalPath()

        catalog = getToolByName(self, "portal_catalog")
        brains = catalog.searchResults(
            path=shop_path,
            object_provides=
            "easyshop.core.interfaces.catalog.IProductsContainer")

        if len(brains) > 0:
            products_folder = brains[0]
            return products_folder.getPath().replace(portal_path, '')
        else:
            return shop_path.replace(portal_path, '')
示例#11
0
 def getStartupDirectoryForProducts(self):
     """
     """
     shop = IShopManagement(self).getShop()
     shop_path = "/".join(shop.getPhysicalPath())
     site_url = getToolByName(self, "portal_url")
     portal_path = site_url.getPortalPath()
     
     catalog = getToolByName(self, "portal_catalog")
     brains = catalog.searchResults(
         path = shop_path,
         object_provides = "easyshop.core.interfaces.catalog.IProductsContainer"
     )
     
     if len(brains) > 0:
         products_folder = brains[0]
         return products_folder.getPath().replace(portal_path,'')
     else:
         return shop_path.replace(portal_path,'')
示例#12
0
 def getStartupDirectoryForObject(self):
     """
     """
     shop = IShopManagement(self).getShop()
     return "/".join(shop.getPhysicalPath())
示例#13
0
 def getStartupDirectory(self):
     """
     """
     shop = IShopManagement(self).getShop()
     return "/".join(shop.getPhysicalPath())