Ejemplo n.º 1
0
 def getStartupDirectoryForCategories(self):
     """
     """
     shop = IShopManagement(self).getShop()
     shop_path = "/".join(shop.getPhysicalPath())
     
     return shop_path
Ejemplo n.º 2
0
    def getStartupDirectoryForCategories(self):
        """
        """
        shop = IShopManagement(self).getShop()
        shop_path = "/".join(shop.getPhysicalPath())

        return shop_path
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 6
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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 10
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, '')
Ejemplo n.º 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,'')
Ejemplo n.º 12
0
 def getStartupDirectoryForObject(self):
     """
     """
     shop = IShopManagement(self).getShop()
     return "/".join(shop.getPhysicalPath())
Ejemplo n.º 13
0
 def getStartupDirectory(self):
     """
     """
     shop = IShopManagement(self).getShop()
     return "/".join(shop.getPhysicalPath())