Magento:How to display drop down attribute on the product listing page - list

I have created a drop down attribute with a configurable product.
I would like to add in the grid/list product’s page the combo with the choice of my select attribute in order to be able to put in directly from this page the product into my cart wich is impossible for the moment : i have to go on the second page to choose the attribute.
i’ve read a lot of threads but i don’t find a way to achieve it.
thanks for the help.

So you want product "add to cart button" with "custom attributes" to be added to the product listing pages..there's an extension for this, see below:
http://www.mageworx.com/ajax-cart-magento-extension.html
I have only managed to add an "add all item to cart" button and "add to cart" button on my category listing pages.

For the attributes which have a frontend type “Select” we need to define options that on the product page converted into a dropdown. For example attribute color may have options Red, Green, Blue etc. which are defined in the admin area.
We can easily collect all the defined options for any attribute.
// use your own attribute code here
$attribute_code = "color";
$attribute_details = Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code);
$options = $attribute_details->getSource()->getAllOptions(false);
Foreach($options as $option){
// print_r($option) and find all the elements
echo $option["value"];
echo $option["label"];
}
For more information about magento cart products, visit our Web\Agency-shop

Related

How to set modal dialog title dynamically in oracle apex 18

I want to set modal dialog title dynamically based on an interactive element.
ex) In page 50, I've made an Interactive Grid and set the link on "Title" column, when user click on title column, a modal dialog appears.
I want to set the title of that modal dialog to title column's content.
But modal dialog's title doesn't change dynamically.
In this case, how can I apply the titles dynamically?
I've seen many solution related to this question, but I can't solve my problem.
Let's say, your model page number is 51. Here are step by step approach [TESTED] to dynamically change title of model page:
Create a hidden item in your model page, let's say the hidden item name is P51_Title.
In Interactive report -> title column link -> click on link builder box -> set values -> add Hidden item as P51_TITLE under Name and value as '#Title#' Column (#ColumnName#).
In model page 51 static region header (title property), add hidden item value as &P51_TITLE. (dot is mandatory to add at last. This is substitution string with & and dot(.) before and after of item name respectively)
save both the pages and run. when you will click on title column link, the link will be redirecting to the model page and title data will be passed through URL to hidden item in the session, so model page header will automatically change based on title data from report.
I made such dialogcreate js function.
It moves popup page Title to modal dialog title.
So, dynamic calculated title &P51_TITLE. would be applied automatically.
$(document).on("dialogcreate", ".ui-dialog--apex", function(e) {
var lDialog = $(this);
lDialog.find('iframe').on('load',function () {
lDialog.children(".ui-dialog-content")
.dialog("option", "title", $(this.contentDocument).find('title').html());
});
});
I am very disappointed that something like this (or any other solution) do not work in apex modal pages by default!

Is there any way to assign menu icon for flask-admin generated category link?

Is there any way to assign menu icon for flask-admin generated category link?
We can set the icon for menu item via
menu_icon_type=ICON_TYPE_GLYPH, menu_icon_value='glyphicon-tags'
But I didn't see any such named parameter existing for category link.
This was recently added as a feature in this pull request: https://github.com/flask-admin/flask-admin/pull/950
Now you can use category_icon_classes when you initialize Admin, like this:
admin = Admin(
app,
name='My Admin',
category_icon_classes={
'Profiles': 'glyphicon glyphicon-wrench',
}
)

Sitecore Page Editor Publishing items related to content

I have a "Product Page",Product page maps to "ProductPage" Sitecore item. Website/Pages/ProductPage.
I have a text area in that page with page editor, which loads text from "Product Example Text" Sitecore item's "Description" text from Web database. (Sitecore.../CommonText/Product Example Text)
In my ascx file, mark up is pretty straigh forwad,
<sc:FieldRenderer ID="FieldRenderer1" runat="server" />
Codebehind,
FieldRenderer1.Item = //"Product Example Text" Sitecore item
FieldRenderer1.FieldName = "Description";
When I open the page in Page Editor(as a system admin), it allows me to change the "Product Example Text", and when I save using the "Save" button on the Page Editor it get saved to the master database. "Product Example Text" item get saved.
Now, when I try to publish the item using the "Publish" item in the Page Editor ribbon, these changes do not get reflected,reason is "Product Example Text" item does not get published.
When I save the page, somehow Sitecore understands the "Product Example Text" item has to be saved. But why does not it get published?
Am I doing anything wrong.... How can I solve this issue?
While saving an item in Page Editor, Sitecore saves all the field renderers which are displayed on the page, so if you set the Item property of a FieldRenderer1 to "Product Example Test" Sitecore Item, Page Editor know which item should be saved.
The problem with publishing is that you enqueue the current item in the publishing queue, but this item has no link to the "Product Example Test" Sitecore Item in any of its properties cause you're setting the Item property of the field renderer dynamically in the code.
The option would be to add another button to Page Editor next to Edit Related Item button and create a command that will Publish Related Item. The complete description how to add such a command can be found in the answer Sitecore page editor - how to extend page editor item editing panel
Another approach would be to create the "Product Example Test" content item under the "ProductPage" as a sub item. In publish options you can use publish sub items, which will publish all content you want.
But the problem is, if you want a particular content to be shared in several places, this won't work.
Maras's answer is a better solution.

How do I change the template of the Mailchimp Wordpress widget?

I want to change how the form looks like and the labels on the fields of the form.
Login in as Admin and then, under the Plugins area in the sidebar, click Editor. There's a dropdown menu labeled "Select plugin to edit". Click that and select "MailChimp" and then click the "Select" button. The sidebar widget form is called mailchimp/mailchimp_widget.php
The form's code begins right after the first PHP block.
You can also edit the code directly by looking in the wordpress/wp-content/plugins/mailchimp/ directory. The translations are in the po sub-directory.
The trick with this template is that the fields are loaded from elsewhere. In order to change the label, you have to set the option of the fields in the PHP code. Each field is looped through and printed out automatically.
For example to change the "Email Address" label to read "Email" add the following code at the end of the first PHP block:
$mv[0]['name'] = 'Email';
This assumes that the first field that will be printed out is the Email Address field. You can do a var_dump to see what other options are available.
If you want to make more drastic changes to the form, remember that when the widget is updated, you'll have to make the changes again and merge them with the updated version.

django admin Add custom button + custom form

I want to add a custom button near 'Add model_name'. When i click on the newly created button i should like to show a custom form where I cans elect a model out of a select box. When i click on save I want to save this model and chance some parameters so it's a 'add' but without selecting all options again. I give a clear example:
I have a model names 'Book'. The first time i create a new book entry, i have a form 'add Book' and i have to fill out the form completely. So i have the book with primary key = Book_1_1 But now i want to add a second book, it's the same book as the first 1 BUT the version changed, so i want a new book but i don't want to select all items anymore in the standard 'add Book' form, i want something like i click on create new instance --> i can select 1 book out of a select box with all book objects in it, and when i 'save' this a new instance of the book gets generated. This instance has the following primary key: Book_1_2 for example. I know how to save this, but i don't know how to change the admin site to do this. I need 2 things:
1) add a button 'new instance' near 'Add_model_name'
2) Deliver a form with all model_name objects in a select box and when i click save i want to retrieve an object with which i can modify some things to save it as 'new book'.
Any ideas?
UPDATE I already added the 'new' button, but like i can see at this moment instead of the url = add , i have to create a new url inside the admin like add_instance etc. Does someone have any documentation on this?
Regards,
Hein
Making it way too hard on yourself. Just do this:
class MyModelAdmin(admin.ModelAdmin):
# Other stuff here
save_as = True
Now you can open up your book entry, change whatever is different and hit "Save as new" and it'll create a new book with that info instead of overwriting the other.