Author Topic: stock refresihing / double sale  (Read 7524 times)

ntunay

  • Beginner
  • *
  • Posts: 28
Re: stock refresihing / double sale
« Reply #15 on: October 03, 2012, 12:59:31 pm »
i really dont know what is wrong. it is adding again out of stock product

ntunay

  • Beginner
  • *
  • Posts: 28
Re: stock refresihing / double sale
« Reply #16 on: October 03, 2012, 13:09:07 pm »
i installed vm 2.10 again. noting is changed

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: stock refresihing / double sale
« Reply #17 on: October 03, 2012, 18:00:20 pm »
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

  • Beginner
  • *
  • Posts: 28
Re: stock refresihing / double sale
« Reply #18 on: October 03, 2012, 19:42:54 pm »
i created a dummy product witout child product or custom field . it works.

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: stock refresihing / double sale
« Reply #19 on: October 03, 2012, 20:12:27 pm »
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

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
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

  • Beginner
  • *
  • Posts: 28
Re: stock refresihing / double sale
« Reply #21 on: October 03, 2012, 21:11:35 pm »
i add my dummy product a custom field. and problem back. i think problem is the custom field

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: stock refresihing / double sale
« Reply #22 on: October 03, 2012, 21:27:37 pm »
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

  • Beginner
  • *
  • Posts: 28
Re: stock refresihing / double sale
« Reply #23 on: October 04, 2012, 15:47:15 pm »
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

  • Beginner
  • *
  • Posts: 28
Re: stock refresihing / double sale
« Reply #24 on: October 08, 2012, 12:29:13 pm »
is there anyone who can help me?

ntunay

  • Beginner
  • *
  • Posts: 28
Re: stock refresihing / double sale
« Reply #25 on: October 11, 2012, 10:59:27 am »
It is a virtuemart problem because i tried on another site. Child product has no stock control

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: stock refresihing / double sale
« Reply #26 on: October 20, 2012, 14:28:02 pm »
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

  • Beginner
  • *
  • Posts: 4
Re: stock refresihing / double sale
« Reply #27 on: January 24, 2013, 14:23:07 pm »
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