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']
Related
Does anyone knows an extensions that will display Joomla! articles, like a category blog layout, based on first interaction visitors choice?
I don't want to stress the visitors and to make them create a user and then select the category of interest unless it's a must do.
I want to make them choose some category of interests (News, Fashion, etc.), set a cookie with those values in their browser and then display the latest articles from those categories and remember for, let's say 30 days, the choice for further visits.
Thanks in advance!
I don't know of any extension to do this, but you could do it yourself easily enough. You could have a page to first check the cookie. If set, then you redirect to the category blog. If not, then this page has a form which collects the info and sets the cookie, and then redirects to the category blog. You could use Breezingforms for this, as it allows you to add post forms actions, so you can set your cookie.
Your category blog would have to be a custom component (I don't think you would get away with a template override of com_content here). You could copy com_content to create a new extension and then you would only need to read the cookie and adjust the categories displayed (instead of the component getting this info from the database). Everything else would be the same (if you have existing template overrides for com_content remember to copy them over).
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.
We have a SOAP connection to magento that is working great - we're able to pull product info, skus, descriptions, etc. using the magento API. We've been able to successfully add products to the cart programmatically with custom options, and that works great. The problem is this:
When you create a custom option for a product, it is assigned a unique ID that has to be called in order to pass that option value to the cart. For example:
www.mysite.com/magento/checkout/cart/add?product=7&qty=1&options[OPTION ID]=robots
Assuming I have my custom option ID correct, this will add 1 product with the option "robots." Which is nice.
However, we have hundreds of products, and while they all use similar custom options, each option is given a unique ID. That means I need to be able to call the magento API and get custom options details (specifically the option ID) so that we can add them to the cart properly. I have been back and forth with Varien Support (Magento), but they are less than helpful, as usual. Now, I know I can find these options by using firebug in Firefox or Chrome, which I've done to test the "add to cart" script. However, that's not a proper solution. I need to be able to grab this data from magento based on product id.
Can this really be that hard? Shouldn't this be tied to the data for the product somehow? I've done a var_dump on the catalog_product.info and i see where it asks if there are options but doesn't provide any details on them. Thoughts?
Thanks in advance.
Do you need to get all options ids for specific products or just some particular? For the latter you can use this code:
$productEntity = Mage_Catalog_Model_Product::ENTITY;
$colorAttribute = Mage::getModel('eav/config')->getAttribute($productEntity, 'color');
$colorAttribute->getId();
For the first option code in this question might be useful How to get all super attribute options for a configurable item in 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 ;)
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