Jump to content
goyan

Display Quantity in product_info, new_product and shoping_cart.php

Recommended Posts

Hello osCommercialist,

 

I'm trying to make a site based on Responsive-osCommerce-2.3.4-GOLD.

 

In admin > configuration > product listing I have enabled (set value to 3) in for  Display Product Quantity and quantity is displayed in specials.php and product_listing.php (only in list view, not in grid)

 

How can I see quantity in new_product.php, product_info.php and shoping_cart.php?

 

Thanks.

 

Share this post


Link to post
Share on other sites

@@goyan

 

Product Info

 

In product_info.php add this where ever you need.
Wrap in <div> or <p> tags if needed.
 

<?php echo TABLE_HEADING_QUANTITY . ' ' . tep_get_products_stock($product_info['products_id']); ?>

Grid view (Specials and Product Listing)

In user.css add
 

/* show product quantity */
.grid-group-item .list-group-item-text {
    display:initial;
    text-align: left;
}

.grid-group-item  .dl-horizontal dt {
    text-align: left;
    width: 100px;
}

.grid-group-item  .dl-horizontal dd {
    margin-left: 0px;
}

New products

add the following code where you want to show quantity
Need to add this into 2 file

catalog/includes/modules/index/templates/
catalog/includes/modules/index_nested/templates/category_new_products.php

Wrap in <div> or <p> tags if needed.
 

<?php echo TABLE_HEADING_QUANTITY . ' ' . tep_get_products_stock($new_products['products_id']); ?>

Shopping Cart

 

Shopping Cart shows already quantity.

Edited by Tsimi

Share this post


Link to post
Share on other sites

Thank you Tsimi.

 

shoping_cart.php is not showin quantity (BS GOLD), but I have found solution and it looks nice:

 

I ahve changed loop before "echo $products_name;": to

 

 

 

for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  
  
  
  
  
   $products_quantity = tep_get_products_stock($products[$i]['id']); 
  
  
  
  
  
      $products_name .= '<tr>';
      $products_name .= '  <td valign="top" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                        '  <td valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><strong>' . $products[$i]['name'] . '</strong></a>';
      if (STOCK_CHECK == 'true') {
        $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
        if (tep_not_null($stock_check)) {
          $any_out_of_stock = 1;
          $products_name .= $stock_check;
        }
      }
      if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
        reset($products[$i]['attributes']);
        while (list($option, $value) = each($products[$i]['attributes'])) {
          $products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
        }
      }
      $products_name .= '<br>' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'style="width: 90px;"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . ' ' . tep_draw_button(NULL, 'glyphicon glyphicon-refresh', NULL, NULL, NULL, 'btn-info btn-xs') . ' ' . tep_draw_button(NULL, 'glyphicon glyphicon-remove', tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product'), NULL, NULL, 'btn-danger btn-xs');
   $products_name .= ' <br>' . TABLE_HEADING_QUANTITY . ": " . $products_quantity;
  
      $products_name .= '</td>';
      $products_name .= '  <td align="right" valign="top"><strong>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</strong></td>' .
          
     

   '</tr>';
    }

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×