How to set catalog_visibility in basic Woocommerce plugin - wordpress

we need to set the catalog_visibility field (as named in postman) in woocommerce (basic plugin), but it does not seem to work the way we go about it. In wordpress it is the setting under single product on the right side, just below “published on”.
We use an ERP system to push the products to our woocommerce shop and need to find the correct article attribute (we then connect the ERP field with the woocommerce attribute and magic happens ... normally)
When I check the product with postman, the field we want to set is called catalog_visibility.
We thus created a field in our ERP with the exact values visible/catalog/search/hidden as we see in postman and tried assigning the article attribute catalog_visibility and also _visibility (but I think this one is for the extension plugin also called "Catalog Visibility"). Neither one worked.
Interestingly, we found out, that both of the attributes we tried to use (_visibility and catalog_visibility) are now shown on the shop's product page (as a table) under a tab called “additional information”, with the value we tried to transfer.
In the backend it is pushed in to the product “properties” tab.
So it seem the values are pushed into woocommerce, but not where and how we want them to.
Has anyone any idea, which attribute (the name) we need to use, to set the visibility of the product?
Thanks!

Related

Make woocommerce product attribute unremovable?

I have a problem with my Woocommerce. I use my supplier's plugin which very regularly and automatically updates the stock and price of my products. I can, on my supplier's site, request that the product updates of their API linked to my site via their plugin do not erase the titles and descriptions of the products (I modified some of them after adding them ).
Problem: I must add to my products an attribute (example "Color") which is not assigned to them by default (they have two but it is not "Color".)
I can add this attribute to them and define a particular color for them, but when they are updated by my supplier, it overwrites the attributes that were not on my basic products (here the "Color" attribute) .
I wish I could tell their API not to overwrite it, like title or description, but they don't know how to do that..
Do you have an idea ?
I got a start of the trail thanks to this page: https://datafeedrapi.helpscoutdocs.com/article/44-prevent-attributes-from-being-overwritten-during-product-set-updates but the code is for THEIR API and so that the value of an attribute is not erased. For me, it's the ENTIRE attribute that I want to preserve..
Thank you !

Wordpress: get previous_post_link() based on custom field value

I have a custom post type. Pages of this custom post type are displayed via a special template. in this template i use previous_post_link() and next_post_link() to create links to previous/next posts of this custom post type.
Since I currently only want to show a few of these custom-post-type pages to my users, I created a custom field called release with a boolean true/false value to indicate if these posts should be shown.
Obviously, the previous/next_post_link() functions should also be aware of that. However, they are not currently. That means they also link to pages where the custom field released is set to false. How can I tell these functions to only use pages where a custom field (released) has a specific value (true).
Update: I know that the solution is to apply some filters to the default functions and to somehow adapt the SQL query which is used to retrieve previous/next posts. However I do not know how to put together the puzzle pieces (where/how to apply the filters and how to adapt the SQL)
This may be related to this question, however I dont really know what to do: https://wordpress.stackexchange.com/questions/8823/how-to-order-adjacent-posts-prev-next-by-custom-field-value
This seems also to be related: https://wordpress.stackexchange.com/questions/96670/custom-post-type-navigation-on-custom-field
couldn't get it to work even though I know how it SHOULD work: addFilter() for get_{$adjacent}_post_join and get_{$adjacent}_post_where with custom SQL query code..
However, this plugin did the trick for me: http://www.ambrosite.com/plugins/next-previous-post-link-plus-for-wordpress
I used the in_same_meta key.

ACF - Template Assignment Seems Permanent

I've been using the Advanced Custom Fields (ACF) plugin for quite a while now. It's absolutely awesome but I'm experiencing some behaviour that is not the norm.
I've noticed that if I change the page template that is assigned to a set of custom fields, the pages that ran off that template (no longer assigned to those fields) effectively holds onto those custom fields and thus renders correctly on the site.
E.g.
ACF Partner Fields are assigned to a Partners Template that has a number of pages running of it.
If I assign these fields to another template, all of the pages running of the Partners template, still render correctly.
I'm not sure I've ever experienced that before and it is causing issues with another plugin that is being integrated for translation.
Any ideas what might be happening?
All time and help is appreciated.
When you change the template, your only changing where those fields appear on the backend and what post type or location they write to in the database. The database table for those unassigned posts still contains the information form those ACF, they just won't be written to any longer.

How to force addition of Product B in order to add product A in Drupal 7?

I am looking for an easy way to associate two products with each other on checkout while at the same time forcing the user to create the association if it doesn't exist yet. Basically, a user can by hosting, but in order to complete the checkout, they also need a domain name. I have classes for each, but I am trying to think of ways to solve two problems:
On checkout, display that two products are associated
Force the user to create the association
Any ideas on what I can use to do that?
UPDATE
What I did was:
Created two separate products
If you add the one, it does a check to see if this item has been linked to another product
If not, it takes you to a custom page forcing you to add and assign the other product
This works, but it's not very elegant. Any better suggestions would be much appreciated.
Use Rules to display messages to the user. Use the event on "add to cart", check the type of product, then check to see if the associated product is added to the cart, if not show message saying you also need to add a hosting package and auto redirect them there. Then upon checkout, check to see if one of those products exist, does the other exist in the cart? Throw same message and auto redirect them to the missing one.
You may need to use components with your rules to get the full effect. But that is what I would do.

Drupal6 - Display specific View from a specific user in page

I need a help displaying a specific View result in a page which the user created it.
story...
"User X has created a Page called My Store and UserX has products which was created in custom Content Item."
Now how do I show this UserX's products in his My Store page?
I have already made a view called User_Store_View, I added a Page Display and on Page Settings:Path, the value was "node/%".. now I guess my problem is on the Arguments?
The path should be something like my-store and it should have an argument of user id. Given your requirements I think setting the default behaviour for the argument being invalid or not being supplied to an empty result set would be the most sensible(I think the default is show all). That may be all you really need.
However, if your product is a type that you've created yourself you will need to do some behind the scenes wiring to expose all your fields to Views; it's almost always better to build a content type using CCK so it's already hooked up to Views. And D7 is a different beast in this regard, with fields part of core and whatnot, so I can't help you out there.

Resources