Example #1
0
    def __init__(
        self,
        hid=None,
        bid=0,
        ts=None,
        title="Apple iPhone",
        descr="Apple iPhone 128Gb with Retina display",
        cmagic=None,
        glparams=[],
        cpa=False,
        hyper=None,
        price=None,
        price_old=None,
        discount=None,
    ):
        self.hid = hid
        self.bid = bid
        self.ts = ts
        self.title = title
        self.descr = descr
        self.cmagic = cmagic
        self.glparams = glparams
        self.cpa = cpa
        self.hyper = hyper
        self.price, self.price_old, self.discount = Offer.__calc_prices(price, price_old, discount)

        Autogen.use("ts", self.ts)
        Autogen.use("cmagic", self.cmagic)
Example #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)))
Example #3
0
    def __init__(self,
                 hid=None,
                 bid=0,
                 ts=None,
                 title='Apple iPhone',
                 descr='Apple iPhone 128Gb with Retina display',
                 cmagic=None,
                 glparams=[],
                 cpa=False,
                 hyper=None,
                 price=None,
                 price_old=None,
                 discount=None):
        self.hid = hid
        self.bid = bid
        self.ts = ts
        self.title = title
        self.descr = descr
        self.cmagic = cmagic
        self.glparams = glparams
        self.cpa = cpa
        self.hyper = hyper
        self.price, self.price_old, self.discount = Offer.__calc_prices(
            price, price_old, discount)

        Autogen.use('ts', self.ts)
        Autogen.use('cmagic', self.cmagic)
Example #4
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)))
Example #5
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 = []
Example #6
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 = []
Example #7
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, {})
Example #8
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))
Example #9
0
def _autogen(*args, **kwargs):
    from autogen import Autogen
    return Autogen(*args, **kwargs)