Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: Move product availability text from description to under price  (Read 3944 times)

Offline calbashmc

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +8/-0
    • View Profile
Move product availability text from description to under price
« on: November 12, 2013, 11:44:59 PM »
Hi

I'd like to move the product status text from the bottom of the product description to under the product price.

Better yet, is it possible to change the 'Add to Cart' button to read 'Pre-order' if an item is out of stock?  Rather than have the customer add it to the cart then see in the cart (by *** which I changed in the template to read '++ Preorder ++') that it is out of stock.

Offline browneyedgirl

  • Newbie
  • *
  • Posts: 25
  • Karma: +4/-0
    • View Profile
Re: Move product availability text from description to under price
« Reply #1 on: October 13, 2015, 11:50:53 AM »
I would like to second the request or find out how I can do this. If the  description is long,  the customer may not see the Availability and currently the checkout just show three red asterisks but does not indicate what those asterisks mean.

Offline browneyedgirl

  • Newbie
  • *
  • Posts: 25
  • Karma: +4/-0
    • View Profile
Re: Move product availability text from description to under price
« Reply #2 on: October 13, 2015, 03:30:51 PM »
FYI - for anyone else trying to modify this,  I found the code to add  .

../storefront/view/default/template/pages/product/product.tpl.

The section with  comments:  Product Description tab & comments  has the following:

<?php if ($stock) { ?>
   <li>
      <span class="productinfoleft"><?php echo $text_availability; ?></span> <?php echo $stock; ?>
   </li>
<?php } ?>

I copied and pasted  the following :
<span class="productinfoleft"><?php echo $text_availability; ?></span> <?php echo $stock; ?>


to the
"right Details" section under "Product Details " (which is closer to the beginning of the file closer .  I inserted it  just before
:
:
<div class="quantitybox">
                     <?php if ($display_price) { ?>
:
:

(i did not include "if $stock" as i found that it would not display if Availability was 0.  (interestingly, it does show if the availability is a negative #!)



Offline junkyard

  • Full Member
  • ***
  • Posts: 127
  • Karma: +25/-0
    • View Profile
Re: Move product availability text from description to under price
« Reply #3 on: October 14, 2015, 03:08:26 AM »
nice hack  --  it duplicates the stock message (exact quantity / out of stock / in-stock   -  the one normally shown among product details down the page)   additionally to the top:  just under the price tag  before the amounts to order.

i think the file to edit was actually ./storefront/view/default_html5/template/pages/product/product.tpl   (if html5 template was/is used ,  the one mentioned was for the default html template)

personally, i prefer to add/edit the *** text explanation (the one shown in bold red when you order more than the stock),  using the   System > Localisation > Language Definitions   ("error_stock"  key for the "checkout_cart" block) ,  just search by ***  in the text field there
(you can even use html hypertext syntax there, add your phone number, etc)

that we can put a negative number into the quantity box is a funny fact  :D  but it doesn't hurt anything cause it gets transformed correctly into a positive in the next ordering screen alright...

To abantecart team:
IMO- Ideally, if *** situation occurs,   the (checkout/cart) order screen could be made to show actual product availability somewhere, maybe in the *** error_stock message itself,  or default the ordered quantity number to the number in stock and explain (if you don't use the pre-orders),  or have some other convenient way to correct ordered amounts without having to go back to the product description page....  Because currently, all you can do is to enter new quantity number BY GUESS and press the 'Refresh' -- you may not know the number in stock without leaving that page (or opening extra tab) and checking the product details again...   The need for the Refresh button itself in the rt=checkout/cart screen always felt like an overly complex idea, at least for me :)

Offline browneyedgirl

  • Newbie
  • *
  • Posts: 25
  • Karma: +4/-0
    • View Profile
Re: Move product availability text from description to under price
« Reply #4 on: October 14, 2015, 08:13:30 AM »
Thanks - Yes, I am using the default template.

Yes, since there is no indication to the customer as to what the *** on the checkout page mean,  I tried to see if I could change it. 
I managed to find the code in cart.tpl file (under ...storefront/view/default/template/pages/checkout/cart.tpl).

 I  originally put additional text  but would ideally (for the reasons you also mentioned)  like to provide an indication as to how many items available.  I therefore tried the following but it does not print anything - if anyone know how to add the right variable syntax, I would appreciate the help.   I figured since the purple highlighted text already existed, I could simply have it display in the text.    If i replace "stock" with any of the other parametes (e.g. name, model, the text will print so I'm not sure why "stock" will not print.  Also  for some reason, if I replace "stock" with "quantity", it for some reason, places a box around the value when displayed - I don't understand why since I didn't change any other formatting.  Anyway here's the code snippit i was trying to modify in cart.tpl:


<?php foreach ($products as $product) { ?>
            <tr>
               <td class="align_center">
                  <a href="<?php echo $product['href']; ?>"><?php echo $product['thumb']['thumb_html']; ?></a>
               </td>
               <td class="align_left"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
                  <?php if (!$product['stock']) { ?>
                     <span style="color: #FF0000; font-weight: bold;"> *** This product is not available in the desired quantity or is out of stock!There are <?php echo $product['stock'] ?> units left. This item will be considered a Pre-Order item at checkout.  </span>
                  <?php } ?>
                  <div>

Offline junkyard

  • Full Member
  • ***
  • Posts: 127
  • Karma: +25/-0
    • View Profile
Re: Move product availability text from description to under price
« Reply #5 on: October 15, 2015, 12:25:53 AM »
i see, indicating actual in-stock amounts for each *** order item is really a good idea, indeed.

AFAIK, the 'stock' parameter is just a setting which controls whether it should subtract the values from 'quantity' (which is the actual stock) on order placement, so you were right moving on to trying out the 'quantity'. The 'quantity' key shows that funny input box as its formatting comes from another file -- ./storefront/controller/pages/checkout/cart.php :

Code: [Select]
$products[] = array(
...
'quantity' => $form->getFieldHtml( array( 'type' => 'input'
...
'stock'    => $result['stock']

I guess you could override the formatting by specifying the integer type exactly:
<?php echo (int)$product['quantity'] ?>

But would it show actual values of your product quantity in stock correctly within that context, and for your abantecart version? 
I am not sure about it  :-\

 

Powered by SMFPacks Social Login Mod