Magento Product_List_Crosssell - list

The Crosssells do not seem to be working on my Magento EE install, for the product view page.
Ive debugged the product list crosssells block, but seems to crash out somewhere on its way through the various code, whilst collecting the collection. Cant work out why (whitescreens when debug to a certain level...and item collection thus not being set. Hard to figure out. No exceptions being logged).
I have no errors on the install...and sure i should not need to edit any logic, as the functionality is provided by default.
Ive followed this example:
http://www.magentocommerce.com/boards/viewthread/51529/
My crossells show on the cart page, as they usually do...but i cant get them to display on my product view page.
Heres my bits of code:
Catalog.xml:
<block type="catalog/product_list_crosssell" name="product.info.crosssell" as="crosssell_products" template="catalog/product/list/crosssell.phtml"/>
product/list/crosssell.phtml:
if(count($this->getItems())): ?>
<div id="also_bought_productslist" class="inner">
<?php $i=0;
foreach ($this->getItems() as $product):
Anyone know what i may be missing. And has anyone added crossells to their product view page?
Just to clarify...THIS IS USING THE DEFAULT PRODUCT_LIST_CROSSELL block...and im NOT trying to utilise the checkout/cart/crossell code (i know this relies on cart functionality/data to work correctly. I did attempt this though, and still get no crossell items....but they DO show in the cart page.)
many thanks

Syntax within the catalog xml file. Namely, an AFTER="blahblah" declaration...and use of same block code twice
Old code:
<block type="catalog/product_list_crosssell" name="product.info.crosssell" as="crosssell_products" template="catalog/product/list/crosssell.phtml"/>
<block type="catalog/product_list_related" name="alsoboughttabs" after="forgettoaddproducts" template="pagetabs/alsobought_pagetabs.phtml" />
<block type="catalog/product_list_related" name="forgettoaddproducts" after="product.info" template="catalog/product/list/dontforgettoadd.phtml" />
New code:
<block type="catalog/product_list_crosssell" name="product.info.crosssell" as="crosssell_products" template="catalog/product/list/crosssell.phtml"/>
<block type="catalog/product_list_upsell" name="alsoboughttabs" template="pagetabs/alsobought_pagetabs.phtml" />
<block type="catalog/product_list_related" name="forgettoaddproducts" after="product.info" template="catalog/product/list/dontforgettoadd.phtml" />

Related

Sitecore WFFM Form not working when inserted as a web control

I created a form which works if I add it as control to Presentation --> Details. What I need to do on another page is inserting the same web form as a web control like this:
<wffm:FormRender FormID="{72857A3A-B6C5-48C0-995B-FA053C82870F}" runat="server" />
The form is shown on the page, but the validations report not filled fields, although they are filled.
Am I missing something?
There you go. This is what you need to do.
<wffm:FormRender FormID="{72857A3A-B6C5-48C0-995B-FA053C82870F}" FormTemplate="/sitecore modules/web/Web Forms for Marketers/Control/SitecoreSimpleFormAscx.ascx" runat="server" />

Create custom ItemStyle template for SharePoint

I've created a custom ItemStyle_ContactDetails.xsl for a SharePoint 2010 content query web part, which points to this custom file via the ItemXslLink property. The web part will be filtered to display only one record for that department's contact info. The list it's reading has these columns:
#Title -- built-in SharePoint column
/dsQueryResponse/Rows/Row/#WorkAddress -- built-in SharePoint column
/dsQueryResponse/Rows/Row/#PrimaryNumber -- built-in SharePoint column
#EMail -- built-in SharePoint column
#Opening_x0020_Hours -- custom multi-line rich text column
The above names are what they're called in the Data View Web Part from another site. I had the following in that DVWP that worked for a local site:
<td colspan="2" class="ms-vb" style="text-align:center">
<b><xsl:value-of select="#Title"/></b><br></br>
<div style="margin-top:10px;"><xsl:value-of
select="/dsQueryResponse/Rows/Row/#WorkAddress"/>
(MAP)
</div>
Tel: <xsl:value-of select="/dsQueryResponse/Rows/Row/#PrimaryNumber"/><br></br>
<xsl:value-of select="#EMail"/>
<p><b>Opening Hours:</b></p>
<div style="position:relative; top:0; margin:0">
<xsl:value-of select="#Opening_x0020_Hours"
disable-output-escaping="yes"/>
</div>
</td>
How do I translate this to the custom ItemStyle_ContactDetails.xsl template? The user needs to see the info without having to click a link to get to it -- it's always going to be just one record for that department. Thanks.
Some serious trial-and-error yielded the result, along with this great article: http://www.heathersolomon.com/blog/articles/CustomItemStyle.aspx
Maybe others trying this same thing can find this useful: You can edit the custom XSL file on the server via SPDesigner, but you can't do the same with the web part and hope to have the changes immediately reflected. You must export the content query web part, then edit the file in Notepad, etc., to make your changes to the following 3 items:
Change the ItemXslLink to point to your custom XSL file:
<property name="ItemXslLink" type="string">/Style Library/XSL Style Sheets/ItemStyle_ContactDetails.xsl</property>
Change the ItemStyle item in the web part to reference your template name; the template name in the XSL file is ContactDetails:
<xsl:template name="ContactDetails" match="Row[#Style='ContactDetails']" mode="itemstyle">
So in your web part, you'd have this:
<property name="ItemStyle" type="string">ContactDetails</property>
Update the CommonViewFields to list your custom columns and their types:
<property name="CommonViewFields" type="string">WorkAddress, Text; EMail,Text; Contact_x0020_Department,Choice; Map,URL; Opening_x0020_Hours,Text; PrimaryNumber, Text</property>
Save the web part file and import (upload) it via the browser to your web part gallery. Each time you make changes to the web part, you'll want to do this; the XSL file can be edited and saved in SPDesigner and the changes reflect immediately in the browser.
Hope this helps someone who gets stuck like I was :)
Whenever I edit "CommonViewFields" in the Webpart, I cannot edit the Properties after inserting the Webpart because of Correlation Error.
I am using SP 2013 onprem. Do I really need to modify the Webpart ? Isn't it enough to create a custom itemstyle.xls ?
I am playing around now for days. Each days more I have to say - Sharepoint is a mess.

Spark ItemRenderer not showing contents

I have a spark list component and a corresponding custom itemrenderer:
list component:
<s:List id="albumImagesList" itemRenderer="the.namespace.for.XYZImageRenderer" useVirtualLayout="false" width="400" height="160">
<s:layout>
<s:TileLayout requestedColumnCount="5"
requestedRowCount="2"
rowHeight="80"
columnWidth="80"
horizontalGap="0"
verticalGap="0" />
</s:layout>
</s:List>
item renderer:
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
autoDrawBackground="true" width="100%" height="100%">
<s:states>
<s:State name="normal" />
</s:states>
<s:BitmapImage source="{data.image_path}" width="70" height="70" horizontalCenter="0" verticalCenter="0" />
</s:ItemRenderer>
It's all fine and dandy, the data gets populated correctly and I verified that the data.image_path property arrives safe and sound inside the itemrenderer.
My only problem is: the image is not displaying. I am not sure if it doesn't render at all or if it's just not visible somehow.
Does anyone see something at first glance? Am I doing something fundamentally wrong here? I worked with mx item renderers before and I never had so much trouble with those.
after a little bit of fumbling and checking i suppose this is the answer to my question. maybe someone can confirm this, but i think it is pretty much spot on:
the "bitmapimage" can only load data from trusted (crossdomain-policy'ed) domains. so with local files it is no problem, but i was loading remote images and with that the bitmapimage silently shuts down and does nothing. no get request, nothing.
the old "image" can load stuff no matter where it originated and so i am now switching to this as a solution.
BitMapImage.source expects one of three things. To quote from docs:
A Bitmap or BitmapData instance.
A class representing a subclass of DisplayObject. The BitmapFill instantiates the class and creates a bitmap rendering of it.
An instance of a DisplayObject. The BitmapFill copies it into a Bitmap for filling.
It sounds like you're giving it a URL location. If so, then use an Image, not BitMapImage.
phew, ok got it fixed using this guy's approach:
http://polygeek.com/2452_flex_extending-spark-bitmapimage
maybe it's going to be of help for someone.
cheers!

Output first string, not all children's strings

I'm having an issue with a bit XSLT code I'm working with for a client. I cannot change the schema, as a flash application depends on it and making any changes would break the ActionScript. It's unfortunate.
This is my first foray into XSLT and I'm admittedly incompetant with it, so I was hoping the community could help me out.
This is the schema (XML file):
<statement title="Click on your Answer" answer="true">
True or False: The question asked is here.
<feedback>
<answerTrue sound="">
The response if the user answered true is here.
</answerTrue>
<answerFalse sound="">
The response if the user answered false is here
</answerFalse>
</feedback>
</statement>
When I try to access the "statement" like this (XSLT):
<div id="statement">
<xsl:value-of select="statement" />
</div>
It displays the "answerTrue" and "answerFalse" nodes along with it. I would like to only display the text "True or False: The ques...". If anyone knows of a tag I can use to display the statement without displaying the child elements, I'd be eternally grateful! Thanks!
Use:
normalize-space(/statement/text()[1])

print a page using xslt

How can print a page using xslt.
i need a link, or a button which when clicked invokes the print page printer dialog box.
I suspect you need to specify a bit more about what you are trying to do.
XSLT is simply a way to turn one block of text into another. The input is generally an xml buffer and the output is some text rendering of that buffer.
It is possible that you are trying to generate a script using XSLT and that you want that script to be able to open a print dialog when it is run by something e.g. you generate javascript, that then runs on a browser.
Can you describe in more detail what you want to achieve?
The following in an html page gives you a print link:
Print
XSLT is a language for transforming XML documents. That means you can add/modify content. Assuming your output is HTML, you can do this:
<xsl:template match="top">
<html>
<head>
</head>
<body>
<input name="print" type="button" value="Print"
onclick="javascript:window.print()">
<xsl:apply-templates />
</body>
</html>
</xsl:template>
But of course, where exactly the button has to go depends on your needs. I'd additionally, add a media=print specific CSS at the top so that the document comes out neat!