News:

Support the VirtueMart project and become a member

Main Menu

Multi Variants and Parent Stock QTY.

Started by mark R, September 18, 2015, 16:24:14 PM

Previous topic - Next topic

mark R

Hi All,

I am having an issues with Multi variants and stock quantities in 3.0.10.

How should i set this up??  If I enter 0 quantity on the Parent product it only displays the Notify Me Option even when I have stock of the child products.

If I put a quantity into the parent it is fine (although this then displays incorrect stock QTY on parent), does the parent quantity get updated when someone buys a child product?

Also I am looking to update the child stock quantities via a PHP script on a regular basis which will not update the parent stock quantity.

I think the easiest solution would be to not display "In Stock" on the product page if it is a parent product, once a buyer selects a size, then display quantity available of that size.

I hope this makes sense.

Any ideas / suggestions would be greatly appreciated.

Many thanks
Mark
Seek and ye shall find.........
4 VM sites and counting

Studio 42

Hi,
I have the inverted problem, i need to use parent stock for variant(and don't check for child stock).
The product are prints and limited edition. The total autorized edition(stock) is this from parent.
I have other work todo before, but if someone have already a code to verify and change parent stock, this help me.
Thanks,
Patrick

mark R

H All,

Could someone please point me in the right to hide stock quantities for parent products.

I m thinking of hiding the "In Stock" for all products with an SKU ending in "-" (all my parent sku's end in -)

I am editing the Product Details template and trying something along the lines of :-

<?php if($show_stock) : ?>
  <div class="product-stock-cont col-sm-6">
<?php if substr($this->product->product_sku,-1) = '-'?> // this is what im trying to get working
   <?php $stock VPFrameworkVM::getStockText($this->product); ?>
<span class="<?php echo $stock->class ?> hasTooltip" title="<?php echo $stock->tip ?>"><?php echo $stock->text ?> : <?php echo $this->product->product_in_stock ?></span>
</div>
<?php endif; ?>
<?php endif; ?>


Any help would be much appreciated

Many thanks
Mark

Seek and ye shall find.........
4 VM sites and counting

GJC Web Design

<?php if substr($this->product->product_sku,-1) != '-'; ?>

??
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

<?php if (substr($this->product->product_sku,-1) !== '-' ): ?>
Bracket are missing too. But in all case this is a poor code.

mark R

#5
Hi,

I am not a programmer so I would expect it to be poor lol. 
It was just to show what I was trying to do.. to hide the stock quantities of parent products on detail pages.

So any help pointing me in the right direction would be much appreciated.

Thanks again
Mark

Sent from my SM-G901F using Tapatalk
Seek and ye shall find.........
4 VM sites and counting

mark R

#6
Many Thanks Studio 42.

Your code does exactly what is was looking for, may I ask why this is the wrong way to do it?

Looks like i'll be booking myself a PHP course.

Thanks again
Mark
Seek and ye shall find.........
4 VM sites and counting

Studio 42

Only my opinion because you need :
Quote(all my parent sku's end in -)
and can give problem when you have to use another sku
I think it's better to check for product parent_id ==0.

mark R

Many thanks Studio 42,

Using the "product.parent_id ==0" would have an effect on products that do not have child products.

Thanks again
Mark

Seek and ye shall find.........
4 VM sites and counting