Пример #1
0
    def save(self, index, glsc, categories, models):
        self.ts = self.ts if self.ts else Autogen.get("ts")
        self.cmagic = self.cmagic if self.cmagic else Autogen.get("cmagic")
        self.hid = self.hid if self.hid else Autogen.default_hid

        index.write("ts:G={0}\n".format(self.ts))
        index.write("cmagic:G={0}\n".format(self.cmagic))
        index.write("_Title={0}\n".format(self.title))
        index.write("Descrutf8={0}\n".format(self.descr))
        index.write("hidd:G={0}\n".format(self.hid))

        categories.add_one(self.hid)
        for p in categories.get_parents(self.hid):
            index.write("hyper_categ_id:S={0}\n".format(p))

        if self.hyper:
            if self.hyper not in models:
                models.append(Model(hyper=self.hyper))
            index.write("hyper:G={0}\n".format(self.hyper))

        index.write("price={0}\n".format(self.price))
        index.write("price_old={0}\n".format(self.price_old))
        index.write("discount={0}\n".format(self.discount))
        index.write("\n")

        for p in self.glparams:
            glsc.write("{hid}:{param}:{value}\n".format(hid=self.hid, param=p.id, value=str(p.value)))
Пример #2
0
    def save(self, index, glsc, categories, models):
        self.ts = self.ts if self.ts else Autogen.get('ts')
        self.cmagic = self.cmagic if self.cmagic else Autogen.get('cmagic')
        self.hid = self.hid if self.hid else Autogen.default_hid

        index.write('ts:G={0}\n'.format(self.ts))
        index.write('cmagic:G={0}\n'.format(self.cmagic))
        index.write('_Title={0}\n'.format(self.title))
        index.write('Descrutf8={0}\n'.format(self.descr))
        index.write('hidd:G={0}\n'.format(self.hid))

        categories.add_one(self.hid)
        for p in categories.get_parents(self.hid):
            index.write('hyper_categ_id:S={0}\n'.format(p))

        if self.hyper:
            if self.hyper not in models:
                models.append(Model(hyper=self.hyper))
            index.write('hyper:G={0}\n'.format(self.hyper))

        index.write('price={0}\n'.format(self.price))
        index.write('price_old={0}\n'.format(self.price_old))
        index.write('discount={0}\n'.format(self.discount))
        index.write('\n')

        for p in self.glparams:
            glsc.write('{hid}:{param}:{value}\n'.format(hid=self.hid,
                                                        param=p.id,
                                                        value=str(p.value)))
Пример #3
0
 def __init__(self, hid, name=None, children=[]):
     self.hid = hid
     self.name = name if name else 'HID-{0}'.format(hid)
     self.id = Autogen.get('tovar_id')
     self.parent = 0
     self.parent_hid = 0
     self.children = []
Пример #4
0
 def __init__(self, hid, name=None, children=[]):
     self.hid = hid
     self.name = name if name else 'HID-{0}'.format(hid)
     self.id = Autogen.get('tovar_id')
     self.parent = 0
     self.parent_hid = 0
     self.children = []
Пример #5
0
 def __init__(self):
     self.__trees = []
     self.default_tree = NavTree(
         id=Autogen.default_navtree,
         nid=Autogen.get('nid'),
         hid=Autogen.root_hid,
         primary=True
     )
     self.__add_tree(self.default_tree, {})
Пример #6
0
 def add_primary(self, hid):
     if hid not in self.__primaries:
         self.__primaries.add(hid)
         self._root.add_children(NavCategory(Autogen.get('nid'), hid=hid, primary=True))