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

why are products in unpublished categories are still published?!

Started by old_fritz, April 15, 2013, 13:42:26 PM

Previous topic - Next topic

old_fritz

Hi there,

I let a cron command automaticly add products from merchands to my vm 2 ( 2.0.14) shop under Joomla! 2.5.8.

categories which are not manually created in my shop are automaticly set to unpublish.
so logicly i thought these categories products were not showing either.
that´s like it should be.

but this products are still published. I recognized it, when i saw it apearing in the top ten or newest products.
you are also possible to search for it and you will find it.

if you click on it, to get the details view, you will get a fault alert:

QuoteNotice: Undefined offset: 8375 in /XXX/XXX/XXX/XXX/modules/mod_vertical_dropmenu/core/MenuBase.php on line 91 Notice: Trying to get property of non-object in /XXX/XXX/XXX/XXX/modules/mod_vertical_dropmenu/core/MenuBase.php on line 92

in category menu, because vm does (for sure) not know which category the product is in.

I just manually create a test product (published) and put it in a manually created new test category (unpublished) - the product appears in the "newest products" box of the starting vm page.
if you click on it the same fault alert is given out.
R
so it´s not just a cron problem.

is there anybody, who know what to do, to avoid this?

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

that´s the way I wish how VM should process:

vm should rule all products, which are in unpublished categories to unshow automaticaly.
if the category is manually renamed and setting to another subcategory and then published, the products should automaticly shown up (published) again, also.

thx

old_fritz

after some hours search for an answer...

... rather seems to be an old problem:

http://forum.virtuemart.net/index.php?topic=33184.msg100351#msg100351

unfortunetaly the last post of that tread and probably the solution doesn´t work anymore.

(remembers on an old hitchcock movie, where the last witness is fade away and can´t spell the name of the murderer anymore) ; ))


old_fritz

another "old" solution:

http://forum.virtuemart.net/index.php?topic=54607.msg178146#msg178146

but I can´t find the "ps_product.php" file in VM2.

Does that file still exist in VM2 ?!

K&K media production

no this file is only in vm 1

in vm 2 it shoul be this file:

administrator/components/com_virtuemart/models/product.php

old_fritz

unfortunately this lines from the ps_product.php does not exist in the product.php file to change:

QuoteIf a product or category is unpublished, products may still be included in the list of recently viewed items. I fixed this by changing ps_product.php lines 2708 & 2709 from:
Code: [Select]

            $q .= "AND c.category_id=cx.category_id LIMIT 0,1";
            $db->query( $q );

to
Code: [Select]

            $q .= "AND c.category_id=cx.category_id ";
            $q .= "AND p.product_publish='Y' ";
            $q .= "AND c.category_publish='Y' ";
            $q .= "LIMIT 0,1";
            $db->query( $q );
            if( !$db->next_record() ) {
               continue;
            }

so what to do? any idea?
THX

K&K media production

yes, vm1 and vm2 are different

you must look for the right sql queries and change it (if you have a little bit php & mysql knowledge)

but this is a core hack and you will lost the changes with next update

old_fritz

unfortunately - I have not.  :(

Thought it is a known and rather old problem.
Strange - I think that should be fundamental in an ecommerce programm.

It make just no sense to have published products in unpublished categories.

Hard to believe that there is still no solution found for VM2.

However thanks for your help,
may someone else have an idea?!

Milbo

Ehrm the solution is already there. It just needs a bit flexibility in mind. And no it is not fundamental for an ecommerce programm that it works the way you think it should work.

Virtuemart 2 has multiple categories per product. So tell me how should the logic decide if a product should be visible or not, in case one category is published and the other not? There is no real solution. Sometimes products use as second category a child category of the other.
Therefore there is another solution which is more user view based. Just enter the product list, use the category filter, check your desired category,.. now you see all your products of one category, set the list to 400. So you can publish/unplublish products of a certain category quite fast. Of course it depends on the amount of your products. In case you have 50k products in one category, then it is a bit nasty, one the other hand, just one quite easy query.
On the other hand, we could add another task to category edit (publish, unpublish all products of this category), but it will confuse the most people which are already used to the filter solution. And the 10% users with really massive amount of products are used to sql usually.

But to underline, it is intended design that unpublished categories do not unpublish the product. Another reason is also the handling of calculation rules.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

WebStuff

I know this is a bit of an old  thread but I've just come across this problem.
In VM1 the Search Module didn't list products in unpublished categories even if the product was still published and would list them if they were in multiple categories if one of those categories was still published. I actually found this a more logical way for the shop to work. I.E. Just unpublish a category rather than 100 products it contains.

I think the queries should be amended to include a category(categories) = published check.
I.E if any category the product is in is published then show product if none of the categories are published then don't.
I'll work on some query variations and see if I can come up with something as this is important for my store as I need certain products published for custom items but the category must be unpublished or customer can buy the product by entering there own price, not good.  :)

iWim

Hello,

I created a new topic about this subject a few days back. It was closed and linked to this one.
So here's what I wrote. In the hope it may be added to VM or someone found a fix.

Thank you.


My original post:

Products that are located in unpublished categories are displayed in the search results when we use VM search module.

The reason why WE have products in unpublished categories is because we use Product Builder so customers can create their own product.
Some of these selections (=products) in PB cannot be bought separately and should not be displayed in the regular shop.

Now I'm not a coder, but maybe you can make it so products from unpublished categories do not show in the search results.
Somewhere in the line of display products from categories where categories != unpublished.

If a product is in a published category it should display the product in the search results
If a product is in a published AND an unpublished category it should display the product
If a product is in an unpublished category it should not display the product

Thank you.
Wim


xxldzxx

Quote from: Milbo on April 22, 2013, 10:26:40 AM
Ehrm the solution is already there. It just needs a bit flexibility in mind. And no it is not fundamental for an ecommerce programm that it works the way you think it should work.

Virtuemart 2 has multiple categories per product. So tell me how should the logic decide if a product should be visible or not, in case one category is published and the other not? There is no real solution. Sometimes products use as second category a child category of the other.
Therefore there is another solution which is more user view based. Just enter the product list, use the category filter, check your desired category,.. now you see all your products of one category, set the list to 400. So you can publish/unplublish products of a certain category quite fast. Of course it depends on the amount of your products. In case you have 50k products in one category, then it is a bit nasty, one the other hand, just one quite easy query.
On the other hand, we could add another task to category edit (publish, unpublish all products of this category), but it will confuse the most people which are already used to the filter solution. And the 10% users with really massive amount of products are used to sql usually.

But to underline, it is intended design that unpublished categories do not unpublish the product. Another reason is also the handling of calculation rules.

Hi Milbo.

Your solution does not work.

I have unpublished category. And all products in this category are unpublished. And no one product is in other category. But still this unpublisched products are displaying   in module "Virtuemart products". This module is set to display random products from all categories ("main category"). It must be set this way because the is no option to set separate categories.


How to solve it?

Thank you.


maxispin

Back to old question. Solution was later given. Go to Settings and from Shopfront untap "Show also products, which are not in at least one published category."
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9