Magento - Working with multiselect and Store view - magento

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.

Related

create and update field to other model backpack laravel

I am trying to create a dashboard to display a specific table and create/update the lines for this table via backpack laravel.
For example I want to display a table of area and this table has a relationship with the cities table.
my problem is when I want to add a specific area and the city associated with it is not added !!.
That I do not want to go to add the city then back to add the area.
This is a very small example of what I'm really dealing with ,
since I want to add a line in a table and this line contains relationships with other tables I want to create on the same page.
I searched and did not find a direct answer. Does it make sense that a new view should be created?
Does the Backpack Laravel not provide a solution to this problem?
If the answer is no and this is what I saw, what is the best solution to this problem ?
Image to summarizes the problem as I want to create the city on the same page as creating the area
I think what you’re looking for is what we call the InlineCreate Operation in Backpack. It adds a “+ Add” button next to the relationship field, so that the admin can add a related item right there, in a modal.
Check out its docs here.

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, hidden products /store view

i have to insert in my store some new products, and i'd like to keep them hidden for users until i have uploaded them all and checked that is all ok.
I think that a hidden store view could be a good solution, but i don't know how to do it. Is possible ? any other solutions ?
thanks!
You can create a new store view by going to System -> Manage Stores. However, you will need to create a new Store Name to be able to assign a different top level category.
Alternatively, create your different Store View and add the new category to the existing structure, setting Is Active to No in Manage Categories. Then choose the new Store View from the dropdown in the top left on the category page, choose the new view, and change Is Active to Yes for that view only.
Does that give you enough of what you need?
Remember, different views and names can be given the same theme too.

Magento unable to retrieve attributes on store view

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 ;)

Resources