Browse Source

modifica botones en el ecommerce

Deisy 8 years ago
parent
commit
f332399fa3
6 changed files with 124 additions and 43 deletions
  1. 36 24
      controllers/main.py
  2. BIN
      controllers/main.pyc
  3. BIN
      models/add_sequence.pyc
  4. 1 1
      static/src/css/custom.css
  5. 21 9
      views/snippets.xml
  6. 66 9
      views/theme.xml

+ 36 - 24
controllers/main.py

@@ -130,7 +130,7 @@ class biztech_theme(http.Controller):
         values={'sub_error':{},'subscribe':{'email':email}}
         if not email:
             values = {'sub_error':{'email':True},'subscribe':{'email':email}}
-            return request.website.render("website.homepage",values) 
+            return request.website.render("website.homepage",values)
         if email:
             if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$", email) != None:
                 pass
@@ -162,11 +162,11 @@ class biztech_theme(http.Controller):
                                                            'customer':True,'subscribe':True},context)
                 success_msg='You have been subscribed successfully.'
             else:
-                already_sub_msg='You are already subscribed.'         
+                already_sub_msg='You are already subscribed.'
         return request.website.render("website.homepage", {'successmsg':success_msg,'already_sub_msg':already_sub_msg})
-    
+
     @http.route(['/home/contact_info'
-    ], type='http', auth="public", website=True)    
+    ], type='http', auth="public", website=True)
     def contacts(self,**post):
         cr, uid, context, pool = request.cr, request.uid, request.context, request.registry
         uid=SUPERUSER_ID
@@ -177,38 +177,38 @@ class biztech_theme(http.Controller):
         subject=post.pop('email_subject', '')
         msg=post.pop('message', '')
         contact={'full_name':name,'emp_email':email,'email_subject':subject,'message':msg}
-        values={'error':{},'contact':contact}  
+        values={'error':{},'contact':contact}
         if not name:
-            values['error'].update({'full_name': True})  
+            values['error'].update({'full_name': True})
         if not email:
-            values['error'].update({'emp_email': True}) 
+            values['error'].update({'emp_email': True})
         if email:
             if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$", email) != None:
                 pass
             else:
-                values['error'].update({'emp_email': 'invalid'})     
+                values['error'].update({'emp_email': 'invalid'})
         if values and values.has_key('error')  and values['error']:
-            return request.website.render("website.contactus", values)  
-        if  super_email:   
-            body="<p>Hello,Admin<br/><br/> Name: "+name+" <br/><br/>Email Address: "+email+ " <br/><br/> Subject: "+subject+" <br/><br/> Message:"+msg+"<br/><br/> Thanks" 
+            return request.website.render("website.contactus", values)
+        if  super_email:
+            body="<p>Hello,Admin<br/><br/> Name: "+name+" <br/><br/>Email Address: "+email+ " <br/><br/> Subject: "+subject+" <br/><br/> Message:"+msg+"<br/><br/> Thanks"
             temp_id= pool.get('ir.model.data').get_object(cr, uid, 'kingfisher', 'contact_info_email')
             pool.get('email.template').write(cr, uid, temp_id.id, {'email_to': super_email,'subject' : subject,'body_html':body or ''}, context=context)
-            pool.get('email.template').send_mail(cr, uid, temp_id.id,partner.id,True, context=context)                        
+            pool.get('email.template').send_mail(cr, uid, temp_id.id,partner.id,True, context=context)
             return request.website.render("website.contactus", {'successmsg':'Your message has been sent successfully.'})
         return request.website.render("website.contactus", {'failmsg':'Your message has not been sent.'})
-        #return request.redirect("/page/contactus")     
-        
+        #return request.redirect("/page/contactus")
+
     def get_pricelist(self):
-        return get_pricelist()    
+        return get_pricelist()
 
 
     @http.route(['/shop/product/comment/<int:product_template_id>'], type='http', auth="public", methods=['GET','POST'], website=True)
-    def product_comment(self, product_template_id, **post):                                          
-        if not request.session.uid:            
+    def product_comment(self, product_template_id, **post):
+        if not request.session.uid:
             request.session.update({'comments':post.get('comment')})
             return login_redirect()
-        cr, uid, context = request.cr, request.uid, request.context        
-        if post.get('comment') or request.session.has_key('comments') and request.session.comments!=None:            
+        cr, uid, context = request.cr, request.uid, request.context
+        if post.get('comment') or request.session.has_key('comments') and request.session.comments!=None:
             request.registry['product.template'].message_post(
                 cr, uid, product_template_id,
                 body=post.get('comment') or request.session.comments,
@@ -217,7 +217,7 @@ class biztech_theme(http.Controller):
                 context=dict(context, mail_create_nosubscribe=True))
             if request.session.has_key('comments') and request.session.comments!=None:
                 request.session.update({'comments':None})
-                return werkzeug.utils.redirect('/shop/product/' +str(product_template_id)+ "#comments")        
+                return werkzeug.utils.redirect('/shop/product/' +str(product_template_id)+ "#comments")
         return werkzeug.utils.redirect(request.httprequest.referrer + "#comments")
 
 
@@ -351,15 +351,27 @@ class biztech_theme(http.Controller):
             value['brand_header'] = post.get('product_label')
         return request.website.render("kingfisher.our_brand_slider", value)
 
+    @http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True)
+    def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
+        cr, uid, context = request.cr, request.uid, request.context
+        request.website.sale_get_order(force_create=1)._cart_update(product_id=int(product_id), add_qty=float(add_qty), set_qty=float(set_qty))
+        #return request.redirect("/shop/cart")
+	prod_obj = request.registry.get('product.product')
+        product = prod_obj.browse(cr,uid,int(product_id),context=context)
+        tpl_obj = request.registry('product.template')
+        tpl_ids = tpl_obj.search(cr,uid, [('id', '=', product.product_tmpl_id.id)],context=context);
+        template = tpl_obj.browse(cr,uid,tpl_ids, context=context)
+
+	return request.redirect('/shop/product/%s' % slug(template))
+
 class product_zoom_config(website_sale):
-        
+
     @http.route(['/product/zoom_type'], type='json', auth="public", website=True)
     def get_zoom_type(self, type_id=None):
         cr, uid, context = request.cr, request.uid, request.context
         result=False
         result=request.website.inner_zoom
-        return result 
+        return result
 
-    
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
controllers/main.pyc


BIN
models/add_sequence.pyc


+ 1 - 1
static/src/css/custom.css

@@ -39,7 +39,7 @@ b, strong{ font-weight: 600;}
 .pagination > .active > span:hover { background: #222; border-color: #222;}
 .pagination > li > a, .pagination > li > span { color: #222}
 
-.well {background-color: #000; border-radius: 0;  box-shadow: none; }
+.well {background-color: #D8D8D8; border-radius: 0;  box-shadow: none; }
 .expanded-message h3 { margin: 0; padding: 0 0 10px 0;}
 .expanded-message .search-box { position: relative; width: 100%; display: inline-block; padding: 0; margin: 10px 0 0;}
 .expanded-message .search-box .btn{ position: absolute;  right: 0;  top: 0;}

+ 21 - 9
views/snippets.xml

@@ -139,7 +139,7 @@
 	<div class="row our-brands">
 		<div class="col-md-12">
 		  <h3 class="section-title style1" t-if="not brand_header"><span>NUESTRAS MARCAS</span></h3>
-    
+
 		  <h3 class="section-title style1" t-if="brand_header"><span><t t-esc="brand_header"/></span></h3>
 				          <t t-set="website_brans_img" t-value="website.get_brand_img()"/>
 		  <div class="owl-carousel" t-if="website_brans_img">
@@ -187,7 +187,7 @@
 
 
 
-                                        <div class="pro-info">
+                                        <div class="pro-info" align="center">
                                             <div class="title">
                                                 <a t-attf-href="/shop/product/#{slug(product)}">
                                                     <span t-esc="product.name"/>
@@ -215,13 +215,25 @@
                                                      </div>
                                                 </span>
                                             </div>
-											<div class="add-cart" t-if="website.user_id != user_id">
-												<form action="/shop/cart/update" method="post">
-												<input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
-												<button class="btn btn-primary" onclick="submit();">
-											  	<i class="fa fa-shopping-cart"></i> Agregar a carrito</button>
-											  	</form>
-											</div>
+                                            <div class="add-cart "  align="center" t-if="not user_id.partner_id.name == 'Public user'">
+                                                              <!--     <div class="add-cart "> -->
+                                                              <form action="/shop/cart/update" method="post" t-if="not len(product.product_variant_ids)&gt;1">
+                                                                  <input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
+
+                                                              </form>
+                                                              <t t-if="len(product.product_variant_ids)&gt;1">
+                                                                  <a t-attf-href="/shop/product/#{slug(product)}">
+                                                                      <button class="btn btn-primary" onclick="submit();">
+                      	  	Elija su opción de compra.</button>
+                                                                  </a>
+                                                              </t>
+                                                               <t t-if="not len(product.product_variant_ids)&gt;1">
+                                                                  <a t-attf-href="/shop/product/#{slug(product)}">
+                                                                      <button class="btn btn-primary" onclick="submit();">
+                            	Elija su opción de compra.</button>
+                                                                  </a>
+                                                              </t>
+                                                          </div>
                                         </div>
                                     </div>
                                 </t>

+ 66 - 9
views/theme.xml

@@ -252,7 +252,7 @@
 						                <div class="actions">
 						                  <t t-set="website_sale_order" t-value="website.sale_get_order()"/>
 						                  <a t-attf-href="/shop/cart" t-if="website_sale_order and website_sale_order.website_order_line">
-						                  	<button class="btn btn-primary" title="Checkout" type="button"><span><span>Checkout</span></span></button>
+						                  	<button class="btn btn-primary" title="Checkout" type="button"><span><span>Ver <i class="fa fa-shopping-cart"/></span></span></button>
 						                  </a>
 						                </div>
 						            </div>
@@ -810,7 +810,7 @@
 			                    </t>
 			                    <t t-call="website_sale.product_price"/>
 			                    <p t-if="len(product.product_variant_ids) &gt; 1" class="css_not_available_msg bg-danger" style="padding: 15px;">Product not available</p>
-			                    <a id="add_to_cart" class="btn btn-primary btn-lg mt8 js_check_product a-submit" href="#">Agregar a carrito</a>
+			                    <a id="add_to_cart" class="btn btn-primary btn-lg mt8 js_check_product a-submit" href="#">Agregar al carrito.</a>
 			                  </div>
 			                </form>
 
@@ -1318,11 +1318,6 @@ Somos una tienda mayorista que trabajamos exclusivamente para vos, con las mejor
               </div>
                   </t>
 
-
-
-
-
-
 		        <div class="pro-info">
 		        	<div class="title"><a itemprop="name" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))" t-field="product.name"/></div>
 		                <div class="price-box">
@@ -1362,7 +1357,69 @@ Somos una tienda mayorista que trabajamos exclusivamente para vos, con las mejor
 			 			<t t-if="td_product">
 			 				<t t-set="product" t-value="td_product['product']"/>
 	 						<div class="item col-lg-4 col-md-4 col-sm-4 col-xs-6">
-							<t t-call="kingfisher.product_itms"/>
+                <div class="product">
+
+                                             <div class="product-img">
+      				<a itemprop="url" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']&gt;1 else None))">
+  		          	<img itemprop="image" class="img img-responsive" t-att-src="website.image_url(product, 'image','300x300')"/>
+  					</a>
+
+  			    </div>
+
+              <t t-foreach="website.get_multiple_images(product.id)" t-as="im">
+                <div class="image-back">
+                      <span itemprop="image">
+                        <img t-att-src="website.image_url(im, 'image')"/>
+                  </span>
+                </div>
+                    </t>
+
+
+                                  <div class="pro-info"  align="center">
+                                      <div class="title">
+                                          <a itemprop="name" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']&gt;1 else None))" t-field="product.name"/>
+                                      </div>
+                                      <div class="price-box"  align="center" t-if="website.user_id != user_id">
+                                          <div class="product_price">
+                                              <span class="special-price">
+                                                  <div itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" class="product_price" t-if="product.product_variant_ids">
+                                                      <b>
+                                                          <t t-if="(product.lst_price - product.price) &gt; 0.1">
+                                                              <del class="text-danger" style="white-space: nowrap;" t-field="product.lst_price" t-field-options="{                                       &quot;widget&quot;: &quot;monetary&quot;,                                       &quot;from_currency&quot;: &quot;product.company_id.currency_id&quot;,                                       &quot;display_currency&quot;: &quot;user_id.partner_id.property_product_pricelist.currency_id&quot;                                     }"/>&amp;nbsp;
+
+
+
+
+                                                          </t>
+                                                          <span t-field="product.price" style="white-space: nowrap;" t-field-options="{                                        &quot;widget&quot;: &quot;monetary&quot;,                                        &quot;display_currency&quot;: &quot;user_id.partner_id.property_product_pricelist.currency_id&quot;                                    }"></span>
+                                                          <span itemprop="priceCurrency" style="display:none;" t-esc="user_id.partner_id.property_product_pricelist.currency_id.name"/>
+                                                          <span itemprop="price" style="display:none;" t-esc="product.price"/>
+                                                      </b>
+                                                  </div>
+                                              </span>
+                                          </div>
+                                      </div>
+                                      <div class="add-cart "  align="center" t-if="not user_id.partner_id.name == 'Public user'">
+                                          <!--     <div class="add-cart "> -->
+                                          <form action="/shop/cart/update" method="post" t-if="not len(product.product_variant_ids)&gt;1">
+                                              <input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
+
+                                          </form>
+                                          <t t-if="len(product.product_variant_ids)&gt;1">
+                                              <a t-attf-href="/shop/product/#{slug(product)}">
+                                                  <button class="btn btn-primary" onclick="submit();">
+  	  	Elija su opción de compra.</button>
+                                              </a>
+                                          </t>
+                                           <t t-if="not len(product.product_variant_ids)&gt;1">
+                                              <a t-attf-href="/shop/product/#{slug(product)}">
+                                                  <button class="btn btn-primary" onclick="submit();">
+        	Elija su opción de compra.</button>
+                                              </a>
+                                          </t>
+                                      </div>
+                                      </div>
+                              </div>
 							</div>
 		            	</t>
 		        	</t>
@@ -1404,7 +1461,7 @@ Somos una tienda mayorista que trabajamos exclusivamente para vos, con las mejor
     <a class="btn btn-default btn-xs fa fa-shopping-cart a-submit"/>
   </xpath>
 </template>
-<template id="products_add_to_cart" inherit_id="kingfisher.product_itms" active="False" customize_show="True" name="Agregar a carrito">
+<template id="products_add_to_cart" inherit_id="kingfisher.product_itms" active="False" customize_show="True" name="Add to Cart">
   <xpath expr="//div[@class='price-box']" position="after">
 
 	<div class="add-cart">