How to add images to taxonomies in spreecommerce - spree

I want to set up product categories (or "taxonomies" as spreecommerce calls them) containing products.
Is there a way to add a photo to each of them so I can show them in some sort of overview?

Spree::Taxon supports an icon as shown here:
https://github.com/spree/spree/blob/v3.0.2/core/app/models/spree/taxon.rb#L26-L31
If that doesn't work for your purposes you can add another paperclip image to the model following the Logic Customization Guide, then adding it to the view where you want to show the photo as shown in the View Customization Guide.

Related

How to make a statically binded rendering editable via Experience Editor (Sitecore MVC)

So I have a layout view within Sitecore Mvc, this view contained a Controller Rendering that pulls in a header and footer navigation. Example:
#Html.Sitecore().Rendering("/sitecore/layout/renderings/some_rendering")
This specifies a Controller Rendering I've defined in Sitecore. This works great, except when I'm in the experience editor. It doesn't give me the ability to select this rendering. If I create a Placeholder and then define these navigation elements to this placeholder dynamically via Sitecore, then I can, but these navigational elements exist on every page of this layout, so I would like them statically placed instead of using a Placeholder, but I would still like the user to be able to select the navigation element in the experience editor (so I can create custom command to interact with this navigation, such as creating new links, etc).
Does anyone have an idea that will help me achieve this?
Use Edit Frame for that and create Custom Edit Frame Button for operations like adding new element to the navigation.
And remember to pass Datarsource ID or Path as a second parameter to the Html.Sitecore().Rendering() method:
#Html.Sitecore().Rendering("/sitecore/layout/renderings/some_rendering", new { DataSource = "{some-id-or-path}" })
Here is set of blog posts which can help you to understand how Edit Frames work and how to add them in Sitecore MVC solution:
https://visionsincode.wordpress.com/2015/01/08/how-to-use-editframe-in-sitecore-mvc/
https://www.cmsbestpractices.com/how-to-properly-use-sitecore-edit-frames/
https://briancaos.wordpress.com/2011/11/28/using-sitecore-editframe-in-pageedit/
You won't be able to remove the component or move it around the page (yeah, it's statically bound to one place on your layout), but you will be able to edit it's properties and datasource.
You can try to use GlassMapper views and statically inherit the view from the GlassView.
Then you'll be able to use Editable method to render the field.
But the consideration you need to take is that you'll not be able to set a datasource to the component from the page editor or content editor.
Instead of injecting the rendering through the Rendering method you should be able to use standart MVC RenderPartial.
I've used this approach on one of the projects I've been on and it worked.

Django/Wagtail - Dynamically generate choices based on uploaded document

I am trying to implement a Chart Block in Wagtail where a user can upload a spreadsheet via the DocumentChooserPanel and then a chart is generated based on the data in that spreadsheet.
I currently have it functioning, but the user must explicitly specify the variable they want the chart to be based off of:
class ChartBlock(blocks.StructBlock):
data_file = DocumentChooserBlock()
primary_variable = blocks.CharBlock(required=True,max_length=255)
class Meta:
template = 'dataviz/blocks/Chart.html'
icon = 'cogs'
label = 'Chart'
I was wondering if there is any way to have the primary_variable field dynamically populated with the column headers from the spreadsheet uploaded and stored in Documents - so that the user would be able to choose from a list of available variables instead of having to remember what a variable was called.
Thank you so much!
This wouldn't be easy to achieve with a vanilla implementation of Wagtail.
The page edit form is generated on page load, including the population of choice lists. I'm pretty sure that the same is true of choice lists in StreamField blocks, that they are populated as the block is added.
The code for this hangs between wagtailadmin.edit_handlers, wagtailadmin.views.pages and wagtailcore.blocks. It would be a pretty complex customisation.
Another possible route for investigation would be using the insert_editor_js hook to update the primary_variable field once a document was uploaded. However, I'm not sure you'll find a dependable ID to hang an event listener off of.
However, you will soon be able to custom validate the submitted page. A PR has just been submitted to allow this custom validation. That should reduce the amount of user error when adding the primary_variable.
This feature should be available in Wagtail 1.4, which I believe is due for release pretty soon.
I hope that helps.

Displaying options and add to cart on category page - opencart

I am using Opencart v1.5.1.3.1
I want to be able to create a template which certain categories use. Cat1 would use the normal category.tpl file where cat2 would use category-cart.tpl
The category-cart.tpl would have extra functionality of displaying price options and an add to cart button which would normally only work on the products.tpl page.
I know that in order to make this happen I have to modify the category.php controller for category.tpl file.
The question is what do I change in the category.php controller to make this happen?
Add product with options to cart from category page http://www.opencart.com/index.php?route=extension/extension/info&extension_id=8649
You will need to make more changes than can be listed here, so you will need to familiarize yourself with the opencart framework to do what you want. As a starter if you look at the bottom of the category controller you will see what template is loaded. Do a search for template. You could put a if statement here that loads templates based on the value of the selected category.
You will then need to add more code to the controller which loads variables for price options and add to cart.
http://opencart-help.com/modifications/39-add-product-options-to-category-listing-in-opencart.html
Check the above link and you will find out how to show the options
It should then look like this
http://i38.tinypic.com/j7b60k.jpg

osCommerce - How to add dynamic text in the bottom of the category page?

I'm using CRE Loaded v6.2 B2B. It is a modified script of osCommerce.
In category page i see all the products with pagination. I want to add some dynamic text under each category. Text is unique for each category.
I should able to define the text from admin and it should display bottom of the category.
How to do this?
I mean which file i should edit? Is there any documentation available?
Thanks
There are many ways to achieve this. Probably the easiest is to add an extra text field in the category_description table. Then simply follow the trail of the category creation/editing/deleting process and add that field in the admin next to the other ones. Then you will be able to output the text dynamically on the front end of the store.
I have not used CRE Loaded in a long time, but this solution should still work.
I take it you mean to add the text in the categories listing?
There are two ways to do this, one is by editing the index.php and pulling in the category description as a blurb.
There other is to use CDS (content director system) in B2B to create custom page category listings which support blurbs and images and use the URL override to point to your product categories.

Review Site > Need common post template or plugin for product thumbnail, details and description

I'm working on a site in which each post will be dedicated to a single product review. I'd like to have a consistent look for each review so that the product image or cover art is at the top left. To the right of the product image, I'd like a listing of items (author, sales page, product cost, etc).
Below these two, I'd like a summary description area, spanning both columns. I don't want to use tables if possible (the summary description will have a clear:both setting perhaps).
Finally, I'd like to specify a list of "Related Products" in the right sidebar area. I'd like to be able to simply flag a category that contains the "related products" and have the top products in the category shown (as thumbnail images) as well as links to the product page.
Should I create a post template for this or do you have recommendations for a plugin that will work better and database each product separately (rather than placing it all in the post markup)?
TIA :)
For these specific requirements on the stuff you want displayed - yes, you need a post template. WordPress 3.0 introduces custom post types which might ease you in the work, but all the data you insert should be displayed appropriately => product post template OR a lot of html in you post, formatting all that stuff. The least doesn't have any flexibility and if hardly a solution to the problem.