Magento unable to retrieve attributes on store view - magento

I understand the basic concept of global, website and store scope. We are developing a magento webshop that has 1 website and 2 stores. We have created an attribute called product_status which is in the 'store view' scope.
Issue I'm having is the following:
When I go to a certain product in the magento backoffice , select a certain store from the dropdown menu and set the product_status for this product to let's say "Promotion", I am unable to retrieve this value using the following code on list view (list.phtml):
$_product->getAttributeText('status_type')
Afterward when I do the same, but then for default values, the value IS showing! Afterward when I reset the product_status on default value, this time it WILL work per store.
It's pretty weird that you have to set default values before you can set it per store -_-
Anyone got an idea on a work-around for this issue? Am I doing something wrong?

Figured it out, all you have to do is put the attribute as required and it will force magento to load it on every page that involves products ;)

Related

Get store id for each CMS page in Magento

We're extending a custom extension of ours and in a form in the admin page, we're using the store view selector. Once the store is selected, we need to construct a list of the CMS pages for that store.
In order to filter the list of CMS pages based on the selected store, we're trying to insert some javascript to change the pages dropdown as per the selected store and subsequently we need to know what store id, each page belongs to on a per page basis.
Is there an easy way of achieving this? Can't post anything we've tried already as we've literally not managed to come up with anything that doesn't already require the form to be saved so we can get the selection.
Thanks in advance for any assistance.
Not sure about the Javascript part since I am not sure what have written.
If you want to get the store id for a page - you can grab the page using its ID and check the array of store ids for a match. In the case below, $page['store_id'] is an array and can contain multiple store ids. Hope that helps.
$pageId = 12;
$page = Mage::getModel('cms/page')->load($pageId);
$page_StoreIds = $page['store_id']

Magento 1 - categories not updating. New categories added not showing

We have a strange problem with our store (will call it Store A) where any category we add/edit is not reflected on the front-end. Here is is what we have checked and ensured:
The Store's Root category is correct under stores
We emptied the cache and rebuilt the indexes
Our Setup
We have 5 stores running under the same installation and the problem is just with Store A. Strangely, when we assign the root category of Store A to any other store, it shows up fine.
Anyone else experience a similar problem? Any help guideline will be appreciated.
We had the same issue with category info not updating and found that this was the case only when the store view was set to all store views. Select the appropriate store view, then make the category edits and all is good.

magento product attributes and removing them from backend

I want a hidden attribute, or completely not there in backend for some attributes im using to tie to a special product type I created.
I believe I need the attribute assigned to the attribute set in order to be able to use it.. but correct me if I am wrong!
Now that I think about this, I am probably doing this wrong. There is probably a way to add an attribute to PRODUCT_TYPE (my custom product type is "voucher") instead of PRODUCT.
Not sure though.. Hints?
I believe I need the attribute assigned to the attribute set in order to be able to use it
Your attribute needs to be assigned to an attribute set if you want to be able to edit/view the attribute in the Magento Admin area. It sounds like you do not want your attribute visible there, so the simple solution is to: create your attribute without assigning it to an attribute set. You can still assign/edit/view your attribute through database manipulation or by loading the product model and using the magic get & set methods.
$product = Mage::getModel('catalog/product')->load($id);
$product->setFoo('hidden attribute value');
echo $product->getFoo();
Another way is to set the visibility of your attributes by database, have a look here:
Magento - Product Attribute which is not visible/editable in administration
You can also lock attributes and make them readonly for your backend users by using a observer:
Magento read-only and hidden product attributes

Magento - Working with multiselect and Store view

I'm developing a new module for Magento and I need to use the Store View (like in CMS/pages or CMS/blocks).
Thanks to answer of Gergely Varga (magento multiselect insert database) I can now save the new item and automatically Magento saves the stores in the other table (I have 2, one for the item and one with the id of my item and the id of the store).
Now I have 3 problems or more:
1 - Grid.php doesn't show the stores that Magento saved in the stores table.
2 - If I try to modify an item, it doesn't load-show the stores that Magento saved when I created the item.
3 - I can't use the search with the Store view (I don't really care about this one).
Then, what is the problem? I followed the answer of Gergely Varga and I can't see anything different in the code of the CMS/page or CMS/block.
EDIT:
Do you want me to rewrite it or something? I really need help with this, is so frustrating...
The thing is that I am creating a module to add and manage banners. When I create a banner I need to asociate it to some parts of the web using the Store View multiselect. Now, thanks to that post (magento multiselect insert database), it's working, but when I am in the banners manage page, the store view column is not working (it doesn't shows anything). When I want to modify a banner, the same thing, it doesn't show the asociated Store Views.
Thanks, regards.
Now it's all working (the search is not working if you want to use the Store Views field, but I don't care about that).
I don't really know how have I fix all that, but it's working. I think that I had some problems in the models.

how to add default variants to product in magento

I'm very new to Magento.I am having product with some variants like "size" with values "large XX,small XX,medium XX".I want the feature to make any one of this values as default in admin.
my screenshot explanation here
How can i do this
please help me!
When you say you want them to be defaults, you are being a little vague. Are you talking about using configurable products for this? Custom product options? When you say "default in admin", what do you mean? Which page are you referring to? More detail will help us answer the question.
Thanks,
Joe
As far as I know, what you are asking for is not a default functionality of Magento, but it shouldn't be difficult to add some javascript to allow you to force selections at page load time. Ultimately, it's just code, so it's definitely possible to do.
my suggestion would be to add a attribute to all you products called for instance "defaultselect" then you can enter your value easily from the backend to your configurable product.
so now you have a configurable product say a hat which comes in 3 sizes, and has 3 assigned simple products. set the defaultselect value to one of the size values
now some layout xml and javascript is required to get you product attribute to work with the magento selects.
first you want to actually include you js. this is done through the layout xml. you can include update using add js method for PRODUCT_TYPE_configurable handle
now the js. store the js in the skin js folder.
to make this work you would need to know the configurable product defaultselect attribute value we're testing against. this could be retrieved with your own ajax function to a method which checks if the current product has a defaultselect attribute and returns it's value or false.
if you have a value from your ajax function you can work with that ie you have both the returned attributes from the configurable product and magento will return the rest.
however after that it seems to get complicated your going to have to do something with the js magento aready uses to render product options

Resources