Tamioe Posted May 23, 2019 Share Posted May 23, 2019 Buenas!! me he dado contra una pared. Quiero que cuando un cliente ponga mas de una cantidad, el precio del producto lo indique. No hablo de combinaciones, que eso en teoria deberia ser aparte. es si una camiseta, vale 10 una, cuando el cliente ponga la cantidad de 3 ponga 30 euros... en el mismo producto, en el carrito no tengo el problema. Y con las combinaciones seria eso igual... si la talla 2xl tiene un extra de 2 euros, al poner la combinacion si cambia a 12 euros... pero si pongo la cantidad de 2, sigue marcando 12, y quiero que marque 24. No se si me he explicado muy bien... quiero poder hacerlo sin instalar un modulo de pago. Se javascript, pero me da para escribir mi codigo a trompicones, y modificar lo sencillo... por lo que si sabeis donde modificar el js de la plantilla para solucionar esto, seria genial. He probado varias cosas que hay por ahi para cambiar el js, pero es del 1.6, o del primer 1.7... ahora mismo mi tienda tiene el 1.7.5.2 , Alguien tiene alguna idea??? GRACIAS!!!!!!!!!! Link to comment Share on other sites More sharing options...
gusman126 Posted May 24, 2019 Share Posted May 24, 2019 (edited) Es algo cutre pero funciona $(document).on('change', '#quantity_wanted', function(){ setTimeout(function() { $price = $('.price').attr('content'); $total = $price * $('#quantity_wanted').val() ; $('.price').text($total+' €'); }, 1500); }); Edited May 24, 2019 by gusman126 (see edit history) Link to comment Share on other sites More sharing options...
Tamioe Posted May 24, 2019 Author Share Posted May 24, 2019 Vale, gracias!! Eso va en el js custom?? O lo meto en el js del theme?? Link to comment Share on other sites More sharing options...
gusman126 Posted May 24, 2019 Share Posted May 24, 2019 prueba en custom js. Link to comment Share on other sites More sharing options...
Tamioe Posted May 24, 2019 Author Share Posted May 24, 2019 Vale. Muchas gracias, ya pondré sí ha funcionado o no. 😊 Link to comment Share on other sites More sharing options...
gusman126 Posted May 24, 2019 Share Posted May 24, 2019 hace 31 minutos, Tamioe dijo: Vale. Muchas gracias, ya pondré sí ha funcionado o no. 😊 Prueba antes en la consola de chrome Link to comment Share on other sites More sharing options...
Tamioe Posted May 25, 2019 Author Share Posted May 25, 2019 @gusman126 Muchas gracias, no funciona, pero bueno. Gracias por intentarlo. Link to comment Share on other sites More sharing options...
gusman126 Posted May 25, 2019 Share Posted May 25, 2019 (edited) Que extraño, hice una prueba en la consola del chrome con un prestashop y si que funciono. Obviamente el precio tachado no esta cambiando. Edited May 25, 2019 by gusman126 (see edit history) Link to comment Share on other sites More sharing options...
Tamioe Posted May 25, 2019 Author Share Posted May 25, 2019 Volveré a intentarlo.... A ver si he puesto algo mal.... Link to comment Share on other sites More sharing options...
cr998 Posted May 25, 2019 Share Posted May 25, 2019 En que versión de prestashop estas trabajando? Link to comment Share on other sites More sharing options...
Tamioe Posted May 25, 2019 Author Share Posted May 25, 2019 @cr998 1.7.5.2 Link to comment Share on other sites More sharing options...
cr998 Posted May 25, 2019 Share Posted May 25, 2019 Has probado a insertar el código dentro de la consola de javascript? Link to comment Share on other sites More sharing options...
Tamioe Posted May 25, 2019 Author Share Posted May 25, 2019 no lo cambia, y me sale esto Quote m.fn.init [document, context: document] m.fn.init [document, context: document] 0: document URL: "http://localhost/prestashop_1.7.5.2/es/home-accessories/6-mug-the-best-is-yet-to-come.html" activeElement: body#product.lang-es.country-es.currency-eur.layout-full-width.page-product.tax-display-enabled.product-id- 6.product-mug-the-best-is-yet-to-come.product-id-category-8.product-id-manufacturer-1.product-id-supplier-0.product-available- for-order adoptedStyleSheets: [] alinkColor: "" all: HTMLAllCollection(412) [html, head, meta, meta, link, title, meta, meta, link, link, link, link, meta, link, link, link, link, link, link, link, link, link, script, meta, meta, meta, meta, meta, meta, meta, meta, meta, meta, body#product.lang- es.country-es.currency-eur.layout-full-width.page-product.tax-display-enabled.pro…, main, header#header, div.header-banner, nav.header-nav, div.container, div.row, div.hidden-sm-down, div.col-md-5.col-xs-12, div#_desktop_contact_link, div#contact- link, a, div.col-md-7.right-nav, div#_desktop_language_selector, div.language-selector-wrapper, span#language-selector- label.hidden-md-up, div.language-selector.dropdown.js-dropdown, button.hidden-sm-down.btn-unstyle, span.expand-more, i.material-icons.expand-more, ul.dropdown-menu.hidden-sm-down, li.current, a.dropdown-item, li, a.dropdown-item, li, a.dropdown-item, li, a.dropdown-item, select.link.hidden-md-up, option, option, option, option, div#_desktop_user_info, div.user-info, a, i.material-icons, span.hidden-sm-down, div#_desktop_cart, div.blockcart.cart-preview.inactive, div.header, i.material-icons.shopping-cart, span.hidden-sm-down, span.cart-products-count, div.hidden-md-up.text-sm-center.mobile, div#menu-icon.float-xs-left, i.material-icons.d-inline, div#_mobile_cart.float-xs-right, div#_mobile_user_info.float-xs-right, div#_mobile_logo.top-logo, div.clearfix, div.header-top, div.container, div.row, div#_desktop_logo.col-md-2.hidden-sm-down, a, img.logo.img-responsive, div.col-md-10.col-sm-12.position-static, div#_desktop_top_menu.menu.js-top-menu.position- static.hidden-sm-down, ul#top-menu.top-menu, li#category-3.category, a.dropdown-item, span.float-xs-right.hidden-md-up, span.navbar-toggler.collapse-icons, i.material-icons.add, i.material-icons.remove, …] anchors: HTMLCollection [] applets: HTMLCollection [] baseURI: "http://localhost/prestashop_1.7.5.2/es/home-accessories/6-mug-the-best-is-yet-to-come.html" bgColor: "" body: body#product.lang-es.country-es.currency-eur.layout-full-width.page-product.tax-display-enabled.product-id-6.product- mug-the-best-is-yet-to-come.product-id-category-8.product-id-manufacturer-1.product-id-supplier-0.product-available-for-order characterSet: "UTF-8" charset: "UTF-8" childElementCount: 1 childNodes: NodeList(2) [html, html] children: HTMLCollection [html] compatMode: "CSS1Compat" contentType: "text/html" cookie: "install_421aa90e079f=522e795277f137b0b9b818cacc15bac5" currentScript: null defaultView: Window {postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, parent: Window, …} designMode: "off" dir: "" doctype: html documentElement: html documentURI: "http://localhost/prestashop_1.7.5.2/es/home-accessories/6-mug-the-best-is-yet-to-come.html" domain: "localhost" embeds: HTMLCollection [] featurePolicy: FeaturePolicy {} fgColor: "" firstChild: html firstElementChild: html fonts: FontFaceSet {onloading: null, onloadingdone: null, onloadingerror: null, ready: Promise, status: "loaded", …} forms: HTMLCollection(3) [form, form#add-to-cart-or-refresh, form, add-to-cart-or-refresh: form#add-to-cart-or-refresh] fullscreen: false fullscreenElement: null fullscreenEnabled: true head: head hidden: false images: HTMLCollection(9) [img.logo.img-responsive, img.js-qv-product-cover, img.thumb.js-thumb.selected., img, img, img, img.img.img-thumbnail.manufacturer-logo, img.js-modal-product-cover.product-cover-modal, img.thumb.js-modal-thumb] implementation: DOMImplementation {} inputEncoding: "UTF-8" isConnected: true jQuery2240181721336073470191: {events: {…}, handle: ƒ, focusout: 2, focusin: 1} lastChild: html lastElementChild: html lastModified: "05/25/2019 19:14:07" linkColor: "" links: HTMLCollection(49) [a, a.dropdown-item, a.dropdown-item, a.dropdown-item, a.dropdown-item, a, a, a.dropdown-item, a.dropdown-item.dropdown-submenu, a.dropdown-item.dropdown-submenu, a.dropdown-item, a.dropdown-item.dropdown-submenu, a.dropdown-item.dropdown-submenu, a.dropdown-item, a, a, a, a, a.text-hide, a.text-hide, a.text-hide, a.text-hide, a.nav- link.active, a.nav-link, a, a#link-product-page-prices-drop-1.cms-page-link, a#link-product-page-new-products-1.cms-page-link, a#link-product-page-best-sales-1.cms-page-link, a#link-cms-page-1-2.cms-page-link, a#link-cms-page-2-2.cms-page-link, a#link- cms-page-4-2.cms-page-link, a#link-cms-page-5-2.cms-page-link, a#link-static-page-contact-2.cms-page-link, a#link-static- page-sitemap-2.cms-page-link, a#link-static-page-stores-2.cms-page-link, a.text-uppercase, a, a, a, a, a.dropdown, a.h3, a#cms- page-3.cms-page-link, a#cms-page-9.cms-page-link, a#cms-page-2.cms-page-link, a#cms-page-7.cms-page-link, a#cms-page-6.cms- page-link, a#cms-page-8.cms-page-link, a._blank, link-product-page-prices-drop-1: a#link-product-page-prices-drop-1.cms-page- link, link-product-page-new-products-1: a#link-product-page-new-products-1.cms-page-link, link-product-page-best-sales-1: a#link-product-page-best-sales-1.cms-page-link, link-cms-page-1-2: a#link-cms-page-1-2.cms-page-link, link-cms-page-2-2: a#link-cms-page-2-2.cms-page-link, …] location: Location {replace: ƒ, href: "http://localhost/prestashop_1.7.5.2/es/home-accessories/6-mug-the-best-is-yet-to- come.html", ancestorOrigins: DOMStringList, origin: "http://localhost", protocol: "http:", …} nextSibling: null nodeName: "#document" nodeType: 9 nodeValue: null onabort: null onauxclick: null onbeforecopy: null onbeforecut: null onbeforepaste: null onblur: null oncancel: null oncanplay: null oncanplaythrough: null onchange: null onclick: null onclose: null oncontextmenu: null oncopy: null oncuechange: null oncut: null ondblclick: null ondrag: null ondragend: null ondragenter: null ondragleave: null ondragover: null ondragstart: null ondrop: null ondurationchange: null onemptied: null onended: null onerror: null onfocus: null onfreeze: null onfullscreenchange: null onfullscreenerror: null ongotpointercapture: null oninput: null oninvalid: null onkeydown: null onkeypress: null onkeyup: null onload: null onloadeddata: null onloadedmetadata: null onloadstart: null onlostpointercapture: null onmousedown: null onmouseenter: null onmouseleave: null onmousemove: null onmouseout: null onmouseover: null onmouseup: null onmousewheel: null onpaste: null onpause: null onplay: null onplaying: null onpointercancel: null onpointerdown: null onpointerenter: null onpointerleave: null onpointerlockchange: null onpointerlockerror: null onpointermove: null onpointerout: null onpointerover: null onpointerup: null onprogress: null onratechange: null onreadystatechange: null onreset: null onresize: null onresume: null onscroll: null onsearch: null onseeked: null onseeking: null onselect: null onselectionchange: null onselectstart: null onstalled: null onsubmit: null onsuspend: null ontimeupdate: null ontoggle: null onvisibilitychange: null onvolumechange: null onwaiting: null onwebkitfullscreenchange: null onwebkitfullscreenerror: null onwheel: null ownerDocument: null parentElement: null parentNode: null pictureInPictureElement: null pictureInPictureEnabled: true plugins: HTMLCollection [] pointerLockElement: null previousSibling: null readyState: "complete" referrer: "http://localhost/prestashop_1.7.5.2/es/8-home-accessories" rootElement: null scripts: HTMLCollection(11) [script, script, script, script, script, script, script, script, script, script, script] scrollingElement: html styleSheets: StyleSheetList {0: CSSStyleSheet, 1: CSSStyleSheet, 2: CSSStyleSheet, 3: CSSStyleSheet, 4: CSSStyleSheet, 5: CSSStyleSheet, 6: CSSStyleSheet, length: 7} textContent: null title: "Mug The best is yet to come" visibilityState: "visible" vlinkColor: "" wasDiscarded: false webkitCurrentFullScreenElement: null webkitFullscreenElement: null webkitFullscreenEnabled: true webkitHidden: false webkitIsFullScreen: false webkitVisibilityState: "visible" xmlEncoding: null xmlStandalone: false xmlVersion: null __proto__: HTMLDocument context: document length: 1 __proto__: Object(0) ahora mismo estoy con la plantilla por defecto,en mi pc con el xampp, antes de probarlo en la tienda en la que estoy trabajando, porque en la tienda tambien estoy con esta misma plantilla y version, salvo que la otra esta modificada totalmente por css... y con css, no tengo problemas, por que se me da de maravilla.... ahora bien, con el javascript, se me atasca. Link to comment Share on other sites More sharing options...
gusman126 Posted May 27, 2019 Share Posted May 27, 2019 (edited) Vale, ya veo, la plantilla "classic" funciona diferente a la plantilla que he usado como ejemplo por lo que debes cambiar el codigo para que coincida con los campos correctos. Y hacer pruebas en la consola He probado con esto, pero no lo hace bien con productos con descuentos. $(document).on('change', '#quantity_wanted', function(){ setTimeout(function() { $price = $('.current-price').find( "span" ).attr('content'); $total = $price * $('#quantity_wanted').val() ; $('.current-price').find( "span" ).text($total+' €'); }, 1500); }); El Prestashop no esta preparado para eso, por lo que vas a tener que hacer un modulo y que lo gestione correctamente o cambiar mucho mas codigo que añadir 5 lineas Edited May 27, 2019 by gusman126 (see edit history) Link to comment Share on other sites More sharing options...
Tamioe Posted May 27, 2019 Author Share Posted May 27, 2019 vale, gracias, lo intento. Si no, pues vere lo del modulo, hay uno de pago, pero al quererlo gratuito.. He pensado en intentarlo, haciendo un formulario con js y meterlo en el contentbox... a ver si funciona. Tengo que investigarlo... Muchas gracias por la ayuda!!!! Link to comment Share on other sites More sharing options...
Tamioe Posted May 27, 2019 Author Share Posted May 27, 2019 @gusman126 funcina, mas o menos...lo cambia y luego vuelve al precio original, no se mantiene. De todas formas es mas de lo que salia antes. Otra vez gracias!! Link to comment Share on other sites More sharing options...
gusman126 Posted May 27, 2019 Share Posted May 27, 2019 hace 39 minutos, Tamioe dijo: @gusman126 funcina, mas o menos...lo cambia y luego vuelve al precio original, no se mantiene. De todas formas es mas de lo que salia antes. Otra vez gracias!! Añade mas tiempo a la espera de la orden , de 1500 a mas tiempo 2000 o 2300, tu web debe ser algo mas lenta que las pruebas que hago. Link to comment Share on other sites More sharing options...
Tamioe Posted May 27, 2019 Author Share Posted May 27, 2019 🤦♀️ya decia yo... Gracias!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now