VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Products, Prices, Tax and Categories VM 1.1 => Topic started by: nuller-joe on March 17, 2010, 10:04:06 am

Title: Replace notify button with add to cart
Post by: nuller-joe on March 17, 2010, 10:04:06 am
Hey guys

Im about to finish up my homepage but i have minor problem:

Is it possibel to change the Notify me! button with add to cart button?

So youre able to buy a product there isnt in stock (you will of cause be told that is not in stock :) )

Thank you

Nuller
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 18, 2010, 00:08:40 am
Just use your stock options as usual, but un-tick the "Check Stock" in your VM admin config.
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 18, 2010, 10:12:02 am
I cant do that, i need the check stock function.
Istn there just a simple hack replacing the notify me with add to cart?
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 18, 2010, 17:51:10 pm
Why do you need to check stock then?
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 18, 2010, 19:08:15 pm
Becuase there might be som long delivery times, so if the customer can see a product in stock, and a product out of stock, they might want to buy the in stock instead.
And i need the notify me button replaced beacuse if they order a product there isnt in stock i have to order it home, and if they just subsribe the product, i dont have an insurance, that they actually want to buy the product when its there.
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 18, 2010, 19:29:01 pm
Right, so instead of hacking the hell out of VM, why not disable the VM "Check stock", and just modify your VM Template to show the # in stock. Just make that number very big, and next to the "add-to-cart" button so they can't miss it!

Much simpler and cleaner. They can still order, but they will know what is in stock and what is not. You can make template so:

0 in stock.
You may order out of stock items,
or order more than what's in stock,
but delivery will be longer in such cases.


ADD-TO-CART-BUTTON
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 18, 2010, 20:44:02 pm
How do i make joomla check stock?, or do i manually have to change the stock number on every product? if thats so, that will be way to confusing, then i also have to change every time someone buys a product..
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 18, 2010, 23:13:24 pm
Checking stock does not disable the CHANGE IN STOCK! Check stock only check to see if stock is available. So if you UNTICK check stock, but still put a stock in your products, stock will still decrement as users buy. Try it yourself with a fake order.
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 19, 2010, 22:19:48 pm
Hm, okay, but the customer still needs to be able to see if the product is in stock or not, and still be able to buy it if it isnt
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 19, 2010, 22:21:19 pm
And what I have suggested would do that. Have you tried it?
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 20, 2010, 07:55:43 am
I havent tried it, because i cant see how they will be able to see how many theres in stock
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 20, 2010, 09:58:13 am
echo $product_availability;

put that in your VM browse template!
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 20, 2010, 13:45:28 pm
Cant get it working, but i kinda suck in codeing. It get the idea now.
Could you specify more what i have to write in the flypage.tpl.php?
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 20, 2010, 20:55:10 pm
1. Here is an example of showing instock... I do use the stock check on this site though, because my clients cannot order more than what is in stock. You can see all I did was call out how much was in stock.
http://www.ccwines.com/central-coast-wines-wine-store.html?page=shop.product_details&flypage=ccwflypage.tpl&product_id=203&category_id=0

2. In your case, I recommend making the stock LARGER, so people can see it.

3. Put this in your product details template you use:
         <?php
           if( $this->get_cfg( 'showAvailability' )) {
              echo $product_availability;
           }
           ?>

You may want to add a font style around it to make it larger, like:

         <div style="font-size:16px;"><?php
           if( $this->get_cfg( 'showAvailability' )) {
              echo $product_availability;
           }
           ?></div>


LIKEWISE, YOU MUST TURN ON THE "SHOW PRODUCT AVAILABILITY" in your VM admin configuration.

VM Admin Configuration -> Site (tab) -> Layout (section) -> Configuration (link) -> Check Yes to: Show Availability Information?


Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 21, 2010, 10:11:28 am
Hm, still cant get it working, its only showing the in stock when "Check Stock" is enabled in core settings..
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 21, 2010, 10:29:57 am
Ooops, edit:

components/com_virtuemart/themes/default/templates/common/availability.tpl.php.

You will see a few php functions (pretty obvious what does what). Edit accordingly. this would be a better place to edit your Stock words size as well, rather than my previous post's styling.
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 21, 2010, 10:41:52 am
Im confused right now... You gotta specify it even more ^^
As i said before, i need some kind of check stock so the custommer can see how manys theres left, but they still need to be able to buy a product out of stock
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 21, 2010, 10:56:08 am
1. Make sure this is in your browse template:

           <?php
           if( $this->get_cfg( 'showAvailability' )) {
              echo $product_availability;
           }
           ?>


2. Edit your:
components/com_virtuemart/themes/default/templates/common/availability.tpl.php.

replace code:
   elseif( ($product_in_stock >= 1 && CHECK_STOCK) ) {

with this code:
   else  {


3. You can keep check stock turned off.
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 21, 2010, 11:30:09 am
It works now, THANK YOU, I am eternally grateful to you ^^
Last question, if i want some text like "in stock: 0, expected delivery date xx, where should that be written?
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 21, 2010, 11:32:35 am
components/com_virtuemart/themes/default/templates/common/availability.tpl.php

Within the statement you just edited!
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 21, 2010, 11:38:12 am
But im not able to make different "text messages" to different stock status? so if >1 "delivry date 12 days" and <1 "delivery date 2 days"?
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 21, 2010, 13:11:31 pm
And i just saw another problem -.-
If theres 0 in stock, and i buy one of them, the stock will change to -1..
Title: Re: Replace notify button with add to cart
Post by: Forrest on March 22, 2010, 07:39:44 am
?? You can do what ever you want!

Maybe you don't want to show negative numbers and give different messages based on stock, so:

   if ($product_in_stock <= 0) {
     echo 'Products in Stock: 0';
     echo 'delivery date 12 days';
   } else { ?>
   <span style="font-weight:bold;">
         <?php echo $VM_LANG->_('PHPSHOP_PRODUCT_FORM_IN_STOCK') ?>:
        </span><?php echo $product_in_stock ?>
        <br /><br />
   <?php  echo 'delivery date 2 days';
   }


My recommendation is you read up on a little php. This is very basic php you are asking about, and can be learned quickly so you can achieve the outcomes you want! good luck!
Title: Re: Replace notify button with add to cart
Post by: nuller-joe on March 22, 2010, 16:09:05 pm
Yeah i know, i will start learning some php soon, i just needed to finish my shop right now :)
I really appreciate your help. I have 3 other minor problems, i dont think it will take long time to fix. Is there any chance you could add me to msn, only if you have the time to help me. If it takes long time, you'll be paid :)

My msn: adamengsig@ofir.dk