Question: Quantity Write To Products Page

Quantity Write To Products Page

I want to show products quantity in products page like the attached picture. I attached my code too. Please help me how can i get quantity. ```php if ( (t || (e += '<div class="col

G

geryke

Asked
I want to show products quantity in products page like the attached picture.
I attached my code too.
Please help me how can i get quantity.

```php
if (
(t || (e += '<div class="col-sm-12"><div class="alert alert-warning text-center padding-xl margin-top-lg"><h4 class="margin-bottom-no">' + lang.x_product + "</h4></div></div>"),
1 == site.settings.products_page && ($("#results").empty(), $(".grid").isotope("destroy").isotope()),
$.each(t, function (s, a) {
a.special_price ? a.special_price : a.price;
var name2 = a.name.split(' ',2);
var name3 = a.name.substr(a.name.indexOf(" ") + 1);

var i = a.special_price ? a.formated_special_price : a.formated_price,
o = (a.promotion && a.promo_price && 0 != a.promo_price && a.promo_price, a.promotion && a.promo_price && 0 != a.promo_price ? a.formated_promo_price : i);
var o2 = o.replace(/ .*/,'');
var i2 = i.replace(/ .*/,'');
var kedvezmeny = o2/i2*100;
var kedvezmeny2 = 100-kedvezmeny;

1 != site.settings.products_page && (0 === s ? (e += '<div class="row">') : s % 3 == 0 && (e += '</div><div class="row">')),
(e +=
'<div class="product-container col-sm-6 col-md-4 ' +
(1 == site.settings.products_page ? "grid-item" : "") +
'">\n <div class="product alt ' +
(1 == site.settings.products_page ? "grid-sizer" : "") +
'">\n ' +
(a.promo_price ? '<div><span class="badge badge-right theme"><img style="position: relative; right:-5px;z-index: 1; " width="120px"src="https://media.mobilbarlang.hu/ribbon2.png"><div style="z-index:3; position:absolute; -webkit-transform: rotate(42deg);-moz-transform: rotate(42deg);-o-transform: rotate(42deg);writing-mode: lr-tb; top: 28px;right: 20px;"><font size="6"color="white">-' + kedvezmeny2 +'%</font></div></span></div>' : "") +
'\n <div class="product-top">\n <div class="product-image">\n <a href="' +
site.site_url +
"product/" +
a.slug +
'">\n <img class="img-responsive" src="' +
site.base_url +
"assets/uploads/" +
a.image +
'" alt=""/>\n </a>\n <div class="product-desc">\n <a href="' +
site.site_url +
"product/" +
a.slug +
'">\n <h2 class="product-name">' +

'<font style="font-weight:bold">'+ name2[0] +'</font> '+ name3 +
'</h2>\n </a>\n </p>\n </div>\n </div>\n </div>\n <div class="clearfix"></div>\n ' +
(1 == site.shop_settings.hide_price
? ""
: '\n <div class="product-bottom">\n <div class="product-price">\n ' +
(a.promo_price ? '<del class="text-danger text-size-sm">' + i + "</del>" : "") +
"\n " +
o +
'\n </div>\n <div class="product-cart-button">\n <div class="btn-group" role="group" aria-label="...">\n <button class="btn btn-info add-to-wishlist" data-id="' +
a.id +
'"><i class="fa fa-heart-o"></i></button>\n <button class="btn btn-theme add-to-cart" data-id="' +
a.id +
'"><i class="fa fa-shopping-cart padding-right-md"></i> ' +
lang.add_to_cart +
'</button>\n </div>\n </div>\n <div class="clearfix"></div>\n </div>') +
'\n </div>\n <div class="clearfix"></div>\n </div>'),
1 != site.settings.products_page && s + 1 === t.length && (e += "</div>");
}),
1 != site.settings.products_page)
)
```
  • MS

    Mian Saleem

    Answered
    Hello,

    You should edit `themes/default/shop/assets/scripts/general.js` (around line 592) and run `gulp cmJs` to minify it.

    Thank you
  • MS

    Mian Saleem

    Answered
    Hello,

    I should be `product.quantity` You can check the getProducts method of the shop model.

    > Please be informed we don't offer support for modifications and modified versions. You are allowed to modify the item as you need as per license.

    Thank you
  • Login to Reply