News:

Support the VirtueMart project and become a member

Main Menu

stock refresihing / double sale

Started by ntunay, October 02, 2012, 22:35:47 PM

Previous topic - Next topic

ntunay

i really dont know what is wrong. it is adding again out of stock product

ntunay

i installed vm 2.10 again. noting is changed

bytelord

hi,

as you told before you think was working without template overrides?
i don't know why this happen on your installation. Can you try on a test product without custom fields or any child products?
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

ntunay

i created a dummy product witout child product or custom field . it works.

bytelord

ok,

So, there is an issue with the child products i suppose because may be there is stock available ...

Try now with your custom fields without child products. If it is working them try to select from the backend Do not Display Product, if child products also out of stock, to see what happens.

It could be a bug, or may be something that haven't been tested.

Regards

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

bytelord

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

ntunay

i add my dummy product a custom field. and problem back. i think problem is the custom field

bytelord

Hi,

Check the posts i gave you before

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

ntunay

ok i read the post and i already made custom fiels this way.

addtocart.php has these code

$stockhandle = VmConfig::get('stockhandle', 'none');
    if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($this->product->product_in_stock - $this->product->product_ordered) < 1) {
?>
      <a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id='.$this->product->virtuemart_product_id); ?>" class="notify"><?php echo JText::_('COM_VIRTUEMART_CART_NOTIFY') ?></a>


but  if i remove this code ($this->product->product_in_stock - $this->product->product_ordered) < 1)

noting is changing.




shopfunctionsf.php has these code

public function getAddToCartButton($orderable){

      if($orderable){
         $html = '<input type="submit" name="addtocart" class="addtocart-button" value="'.JText::_('COM_VIRTUEMART_CART_ADD_TO') .'" title="'.JText::_('COM_VIRTUEMART_CART_ADD_TO') .'" />';
      } else {
         $html = '<input name="addtocart" class="addtocart-button-disabled" value="'.JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT') .'" title="'.JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT') .'" />';
      }

      return $html;
   }
and cart.php has these

if ($stockhandle!='none' && $stockhandle!='risetime') {

         $productsleft = $product->product_in_stock - $product->product_ordered;
         // TODO $productsleft = $product->product_in_stock - $product->product_ordered - $quantityincart ;
         if ($quantity > $productsleft ){
            if($productsleft>0 and $stockhandle='disableadd'){
               $quantity = $productsleft;
               $errorMsg = JText::sprintf('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_QUANTITY',$quantity);
               $this->setError($errorMsg);
               vmInfo($errorMsg.' '.$product->product_name);
               // $mainframe->enqueueMessage($errorMsg);
            } else {
               $errorMsg = JText::_('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_STOCK');
               $this->setError($errorMsg); // Private error retrieved with getError is used only by addJS, so only the latest is fine
               // todo better key string
               vmInfo($errorMsg. ' '.$product->product_name);
               // $mainframe->enqueueMessage($errorMsg);
               return false;
            }
         }
      }


i strugled with these codes but i coulnt find the codes which make stock control for child products or main products
i think it is controling main products stock situation not child products


i add these code

<?php echo JHTML::link($product->link, $this->product->product_in_stock); ?>

to see stock on the page bu t is shows main product stock. what is the child product stock code




sorry it took so much. but i am really deperate


ntunay


ntunay

It is a virtuemart problem because i tried on another site. Child product has no stock control

bytelord

Hello,

I think  is not working with child products ... someone else if have the solution could help you out with that.
I think in vm2.2 this will have been corrected but i am not sure.

did you try 2.0.12d?

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

candrax

Same issue here. I tested with vm 2.0.18a and still same bug. If you have a child product with stock variant then you can add it multiple times in cart no matter if its stock goes empty.

I tested the same thing with the ordinary single product without children and there "add to cart" doesn't actually add the product in cart if quantity is beyond stock.

Anyone has ever found a solution for this?

Thanx