News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

What bugs do you know of in stockable variants plugin

Started by OpenGlobal, May 24, 2012, 14:36:59 PM

Previous topic - Next topic

ArhoN

There is a problem also with the child products weights.

For calculating the shipping it doesnt get the seperate weights of the child items but only the parent products weight.
Havent tested the Length.

This is bad for international shipping cause the difference in price can be huge for large orders.

OpenGlobal

I've attached the latest version which should have fixed these issues.

OpenGlobal E-commerce

[attachment cleanup by admin]

ArhoN

Quote from: OpenGlobal on November 30, 2013, 11:16:58 AM
I've attached the latest version which should have fixed these issues.

OpenGlobal E-commerce
This Latest version fo the stockable.php is not included in the latest vestion of VM 2.0.24c ?

OpenGlobal

The version I have attached will be available in the 2.0.24d version (unless I need to make further changes)

OpenGlobal E-commerce

d_a_w_g_y

Hi OpenGlobal / Team,

I downloaded the latest of stockable.php, I am currently running updated JOOMLA 2.5.16, VM 2.0.24c,

I think this question has been raised on a number of different forums but 'it seems' never a specific answer (infact I didn't find one), so here is the question:

"How do I get current stock level reported on the product details page that reflects my stockable variant?"

For example the following works with a normal product page:

http://forum.virtuemart.net/index.php?topic=107996.0

But each time I changed my stockable variant dropdown, the price changed ok but the stock level remained the same with a static value (which it seems is my first variant that loads when the page loads). I also found:

http://forum.virtuemart.net/index.php?topic=100480.135

Page 10, the question was asked by huegel-huepfer, but I failed to find an answer (please direct me to the correct discussion for this)

So it took a while to track it down, again its not going to suit everyones requirements as its a customization, so you might consider something like this as a configuration option, or maybe it already exists and i've missed it  8)

Anyway changing the following in stockable.php, I am able to view the correct stock level per each stockable variant:

::stockable.php::
if ("disableadd" == stockhandle && stockable_'.$js_suffix.'[found_id].in_stock <= 0) {
  var j = stockable_'.$js_suffix.'[found_id].in_stock;  /* d_a_w_g_y: added this for my stock level */
$(".addtocart-bar>span").remove();
$(".addtocart-bar>div").remove();
$(".addtocart-bar>a.notify").remove();
$(".addtocart-bar").append(\'<div><br></div>\');  /* d_a_w_g_y: added this to create some space */
$(".addtocart-bar").append(\'<div><br></div>\');  /* d_a_w_g_y: added this to create some space */
$(".addtocart-bar").append(\'<a href="ind\'+\'ex.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=\' + found_id + \'" class="notify">' . JText::_('COM_VIRTUEMART_CART_NOTIFY') . '</a>\');
$(".addtocart-bar").append(\'<div><br></div>\');  /* d_a_w_g_y: added this to create some space */
$(".addtocart-bar").append(\'<div>Current Stock: \' + j + \'</div>\'); /* d_a_w_g_y: Heres the stock level, however this is for Notify Me so in theory it should be 0 */
} else {
var quantity = $(".addtocart-bar .quantity-input").val();
var j = stockable_'.$js_suffix.'[found_id].in_stock;    /* d_a_w_g_y: added this for my stock level */
if (isNaN(quantity)) {
    quantity = 1;
}
$(".addtocart-bar>span").remove();
$(".addtocart-bar>div").remove();
$(".addtocart-bar>a.notify").remove();
$(".addtocart-bar").append(\'<span class="quantity-box"><input type="text" class="quantity-input js-recalculate" name="quantity[]" value="\' + quantity + \'" /></span><span class="quantity-controls js-recalculate"><input type="button" class="quantity-controls quantity-plus" /><input type="button" class="quantity-controls quantity-minus" /></span><span class="addtocart-button"><input type="submit" name="addtocart" class="addtocart-button" value="'.JText::_('COM_VIRTUEMART_CART_ADD_TO').'" title="'.JText::_('COM_VIRTUEMART_CART_ADD_TO').'" /></span><div class="clear"></div>\');
$(".addtocart-bar").append(\'<div><br></div>\');  /* d_a_w_g_y: added this to create some space */
          $(".addtocart-bar").append(\'<div>Current Stock: \' + j + \'</div>\'); /* d_a_w_g_y: Heres the stock level for my variant */
Virtuemart.product($("form.product"));
}



cheers

d_a_w_g_y

OpenGlobal

This functionality is beyond the scope of what this plugin was intended to do. It is only meant to handle stock control. If you want other information updated on the page, you would be better off using the Generic Child Variant customfield instead.

OpenGlobal E-commerce

d_a_w_g_y

ye no worries, really appreciate the response,

I already have 800 products using the stockable variant plugin, not looked at the generic child variant (/me wonders how easy it would be to switch over), so figured I need these modifications for the extra functionality, I wanted to see the current stock level for each child product variant,

I also now have extra vendors which is (from what I've read) the only way of handling muliple shops in VM2,

cheers

d_a_w_g_y

ArhoN

OpenGlobal the problem was not lying at the stockable.php file.
The file you send me works perfectly.

inu2005

QuoteMy conclusion for the moment is that when your are using your stockable.php and want to reorder the childs to create a logical dropdownlist order (S/M/L/XL and not L/M/S/XL)  this is possible if you have a single custom field. It does not work if you are dealing with more custom fields.

QuoteThanks very much for your testing. Yes, I found the same thing with the proposed ordering fix. The front end ordering is based on the product ID (a legacy problem that I inherited :-) ) rather than the order that it comes out from the SQL query, so a complete solution for product ordering is still outstanding.

OpenGlobal, unfortenately after updating  Virtuemart to 2.0.26 your stockable.php fix doesn't work anymore, so frontend ordering of the dropdownlist is not possible anymore , not even with one single custom field (or am I mistaken?).

OpenGlobal

Can you provide links and details please.

OpenGlobal E-commerce

inu2005

QuoteOpenGlobal, unfortenately after updating  Virtuemart to 2.0.26 your stockable.php fix doesn't work anymore, so frontend ordering of the dropdownlist is not possible anymore , not even with one single custom field (or am I mistaken?).

Sorry, my mistake. After the update I think I have tested by accident a product which has two custom fields (colour + size), which frontend dropdownlist cannot be ordered.
Now I have tested a product with a single field (only size) and this order can still be changed thanks to your fix.

I still hope there will be a fix for frontend ordering in case you have products with multiple custom fields.

OpenGlobal

I have attached a new version of the stockable.php file with a potential fix for the long-standing "ordering" bug. I have tested this on my system and it seems to be working properly so I'd appreciate some beta testing before I commit this to the next version.

Please remember that when you change the order of the children on the parent product, you need to save the parent product TWICE. The first save is to save the new child order, the second save is to save the stockable custom field settings for the new order.

OpenGlobal E-commerce

[attachment cleanup by admin]

jsneo

I am using Joomla! 2.5.14 and VM 2.0.26d and tried using both the original stockable.php as well as your stockable.php last posted but still faces the "undefined" bug when adding the product to cart.

http://y2style.com/index.php/on-sale/ysl-rock-top-detail

Quote from: OpenGlobal on November 05, 2013, 14:07:01 PM
Those problems are fixed in the version that I attached. I'm talking about the "undefined" bug.

OpenGlobal E-commerce

OpenGlobal

Ah ha!

Thanks to jsneo (who has been helping me via PM) we have now been able to track down the "undefined" bug.

In /components/com_virtuemart/views/productdetails/tmpl/default_addtocart.php (or /templates/$template/html/com_virtuemart/productdetails/default_addtocart.php if you are using a custom template) there are 3 input fields which are nested too deeply inside the if blocks. You may have something that looks like this:


                                <span class="addtocart-button">
                                <?php echo shopFunctionsF::getAddToCartButton ($this->product->orderable);
                                                
// Display the add to cart button END  ?>

                                 </span>
                                        <input type="hidden" class="pname" value="<?php echo htmlentities($this->product->product_nameENT_QUOTES'utf-8'?>"/>
                                        <input type="hidden" name="view" value="cart"/>
                                        <noscript><input type="hidden" name="task" value="add"/></noscript>
                                        <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $this->product->virtuemart_product_id ?>"/>


The "pname", "view" and "virtuemart_product_id[]" need to be moved to the same place as the "option=com_virtuemart" field:


                <input type="hidden" name="option" value="com_virtuemart"/>
                <input type="hidden" class="pname" value="<?php echo htmlentities($this->product->product_nameENT_QUOTES'utf-8'?>"/>
                <input type="hidden" name="view" value="cart"/>
                <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $this->product->virtuemart_product_id ?>"/>

        </form>


OpenGlobal E-commerce

jsneo

Thanks a million OpenGlobal, you really make my day