News:

Looking for documentation? Take a look on our wiki

Main Menu

Attributes/Custom Fields Thread

Started by PRO, September 12, 2011, 15:02:49 PM

Previous topic - Next topic

phonky

dsrpmedia: this is a very good response, thank you very much!

I will approach the client and let her decide, that is the cleanest way.
If they do not want to do pay for the upgrade, I will stick to vm1.1

Thanks again!

dsrpmedia


dsrpmedia

Quotei am having a little trouble with my custom field wondering if you could help. i am getting an error message like this; Warning: Missing argument 4 for plgVmCustomStockable::plgVmOnViewCart() in /homepages/40/d376259668/htdocs/fightstore/plugins/vmcustom/stockable.php on line 345

Myself & a couple others are having a similar issue - there is a thread where we are discussing it here http://forum.virtuemart.net/index.php?topic=100480.new#new


PRO

Quote from: dsrpmedia on April 01, 2012, 02:33:46 AM
Quotei am having a little trouble with my custom field wondering if you could help. i am getting an error message like this; Warning: Missing argument 4 for plgVmCustomStockable::plgVmOnViewCart() in /homepages/40/d376259668/htdocs/fightstore/plugins/vmcustom/stockable.php on line 345

Myself & a couple others are having a similar issue - there is a thread where we are discussing it here http://forum.virtuemart.net/index.php?topic=100480.new#new




Try the latest version of the file here
https://dev.virtuemart.net/svn/virtuemart/trunk/virtuemart//plugins/vmcustom/stockable/

MAKE: sure to backup that file before replacing

dsrpmedia

I am still getting my error

'Warning: Invalid argument supplied for foreach() in /path-to-site/plugins/vmcustom/stockable/stockable.php on line 187'

-------------------------------------------------------------------------------------------------------------------

dsrpmedia

QuoteI am still getting my error

'Warning: Invalid argument supplied for foreach() in /path-to-site/plugins/vmcustom/stockable/stockable.php on line 187'

Steps I have done to get there

fresh joomla 2.5.3 install
fresh VM 2.0.3.H install

installed the sample data

went to 'Custom Fields' (under 'Products')
selected 'New'


Custom Field Type: Plugins
Title - I used ' Additional Sizes'
Published - Yes
Parent - please select
Cart Attribute - Yes
Description - blank
Default   - blank
Tooltip   - blank
Layout position - blank
Admin only - no
Is a list? - no
Hidden - no
Select a plug-in: VM Custom stockable variants

save

then under
'Option name' i put 'Sizes'

15ml
30ml
60ml

save
save & close

go  to 'Products'

I chose "ladder" (parent of Metal Ladder, Wooden Ladder, Plastic Ladder in the standard sample products installed)
go to 'custom fields' in the product details page

under Custom Field Type: I choose 'Additional Sizes' (the custom Attribute I created in step 1)

save

here what is apparently supposed to happen is the child products are supposed to load, and I can then map the child to the custom attribute option.

but what actually happens is I get a message 'Please, add new child product! Thereafter you can select the option for each product' with the option to add children (see attched)

if I try to add a new product I am told I did - but no product is actually created

then I get that error message in the front



[attachment cleanup by admin]

cmalo

I am getting the error :
Invalid argument supplied for foreach() in /plugins/vmcustom/stockable/stockable.php on line 187

someone knows what this could be?

OpenGlobal

How has the product parent/child been set up?

The line referenced is:


foreach($field->child as $child_id => &$attribut) {


So it looks like $field->child hasn't been set up for some reason.

corymp

Quote from: openglobal on April 08, 2012, 11:54:59 AM
How has the product parent/child been set up?

The line referenced is:


foreach($field->child as $child_id => &$attribut) {


So it looks like $field->child hasn't been set up for some reason.
Actually this error only happens on certain servers.
VM 2.0.4 Stable
J2.5.4

dsrpmedia

QuoteActually this error only happens on certain servers.

I`ve tried setting up VM 2 on 2 different hosts - GoDaddy & GreenGeeks - & encountered the same issue on both servers, so I think the problem must be fairly widespread

corymp

And I get the same error on 1and1. But I don't get the error on zend server that  I installed locally.
VM 2.0.4 Stable
J2.5.4

thomaska

#221
Well after a week of being trying to find a solution in my problems with custom fields i would like to say that nothing works as i was expecting too.
I am developing an eshop and there is a simple requirements. Some of the products has different colors and different strength in ml. For some of them i have to add additional cost. Suppose that i have an item which has two colors, Black and Silver, and for the Silver color i would like to add additional cost of 2 euros. The requirement is also these two colors must be stockable. What i tried?

1. Cart Variant: It works as a drop down, without child products, it has the additional cost but it does is not stockable. So a customer can submit for a product color that it is not in stock.
2. Child Variant: It works as a drop down, with child products, it has the additional cost and it is stockable. The problem is that in the drop down box, the parent product appears, which is not for sale because it is the parent product and the customer must choose a color. In case i will unpublish the parent or make it stock unavailable the in the products category either does not appears (in case of unpublished) or it says that it is not in stock which is wrong. Then i tried to make the parent item, as the first child item. Again there is a problem when the parent item (suppose the black) will be out of stock. In the products category will be as out of stock which is wrong because the silver color is in stock.
3. Stockable Variant. It works as i was expecting, dropdown with the available colors, a dropdwn item is dissaperaed when the child item is out of stock, everything was fine except one. It has a text box with additional cost. As soon as the customer adds the product to the cart this additional cost is calculated. What i want? To be visible in the dropdown also next of the color. In order for the customer to know for the additional cost. Now, it does not show anything.

I believe that if the dropdown shows the additional cost also with the color name, it will be great. Any suggestions where that dropdown is filled and how to add next to the description the additional cost?

Best Regards

Thomas

OpenGlobal

Quote from: openglobal on March 02, 2012, 10:29:02 AM
This is definitely a bug.

I've created a main product with three child products. Only one of the child products has any stock.

If the config is set to "Products Out of Stock are orderable, no special action", then everything is fine.
If the config is set to "Do not Display Product", then the main product is not shown at all and access the page manually gives a 404 error.
If the config is set to "Displays 'Notify Me' instead of 'Add To Cart' button" then I get an Add to Cart button still but the out of stock products are missing from the drop down.

Can someone tell me what test framework is being used for Virtuemart because whatever it is needs changing. This is basic FVT stuff which shouldn't be getting to beta level products let alone fully released versions.

As of 2.0.5, nothing has changed in the (dis)functionality. Is anyone working on this?

It seems that the one thing that the stockable variants aren't.....is "stockable"

OpenGlobal

OpenGlobal

#223
Quote from: openglobal on April 13, 2012, 15:10:27 PM
If the config is set to "Do not Display Product", then the main product is not shown at all and access the page manually gives a 404 error.

From just looking at the code at this stage, it looks like the problem for this bug lies at line 250 of /administrator/components/com_virtuemart/models/product.php:


if($app->isSite() && !VmConfig::get('use_as_catalog',0) && VmConfig::get('stockhandle','none')=='disableit' ){
$where[] = ' p.`product_in_stock`>"0" ';
}


If we're using stockable variants, we're not interested in the parent stock level, just the child. For any other type of variants, we'll be interested in either, or both. This line needs to change.


if($app->isSite() && !VmConfig::get('use_as_catalog',0) && VmConfig::get('stockhandle','none')=='disableit' ){
$where[] = ' (p.`product_in_stock`>"0" OR children.`product_in_stock` > "0") ';
}


And we need to add another outer join for the child variants (line 413):


$joinedTables .= ' LEFT OUTER JOIN `#__virtuemart_products` children ON p.`virtuemart_product_id` = children.`product_parent_id` ';


This gets the product_ids but then the out of stock parents are rejected again at line 528:


if($app->isSite() && VmConfig::get('stockhandle','none')=='disableit' && ($child->product_in_stock-$child->product_ordered)<=0){
vmdebug('STOCK 0',VmConfig::get('use_as_catalog',0), VmConfig::get('stockhandle','none') , $child->product_in_stock);
return false;
}


I'm not sure yet how to get around this bit. Does the stock check need to be done twice? Can this block in getProduct just be commented out?

In this specific case, this check is redundant. Are there any other instances where the getProduct() function will receive a product_id that hasn't already been stock checked? If so, we'll need to come up with some way of checking the child variant stock here too.

OpenGlobal


*Mod note Combined Posts by BTP*

Bingo! Got it!

If necessary, we can update the product_in_stock variable with the true value in getProductSingle() around line 676:


$q = 'SELECT SUM(children.`product_in_stock`) + p.`product_in_stock` FROM `#__virtuemart_products` p LEFT OUTER JOIN `#__virtuemart_products` children ON p.`virtuemart_product_id` = children.`product_parent_id`
WHERE p.`virtuemart_product_id` = "'.$this->_id.'"';
$this->_db->setQuery($q);
// change for faster ordering
$product->product_in_stock = $this->_db->loadResult();



Are any Devs reading this thread to get this code (or similar) into the next release?

OpenGlobal

OpenGlobal

Bingo! Got it!

If necessary, we can update the product_in_stock variable with the true value in getProductSingle() around line 676:


$q = 'SELECT SUM(children.`product_in_stock`) + p.`product_in_stock` FROM `#__virtuemart_products` p LEFT OUTER JOIN `#__virtuemart_products` children ON p.`virtuemart_product_id` = children.`product_parent_id`
WHERE p.`virtuemart_product_id` = "'.$this->_id.'"';
$this->_db->setQuery($q);
// change for faster ordering
$product->product_in_stock = $this->_db->loadResult();



Are any Devs reading this thread to get this code (or similar) into the next release?

OpenGlobal