Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: Googlebase code

  1. #1
    jamotion is offline Senior Member
    Join Date
    Jul 2007
    Posts
    215

    Default Googlebase code

    Need some help with logic... sometimes, I have <grice>875.4024.32</grice> as a result, which 875.40 is the qty * the price and 24.32 is the sales price. What am I doing that shows both the total price and price? Thx in advance.


    Code:
              <g:price>
    			
    
    			<xsl:if test="minimumquantity &gt; 0">
    				<xsl:choose>
    					<xsl:when test="number(saleprice)=0">
    						<xsl:value-of select="format-number(price * minimumquantity, '###0.00')" />
    					</xsl:when>
    				  <xsl:otherwise>
    					<xsl:value-of select="format-number(saleprice * minimumquantity, '###0.00')" />
    				  </xsl:otherwise>
    				</xsl:choose>
    			</xsl:if>						
    			<xsl:if test="minimumquantity != 0">
    				<xsl:choose>
    					<xsl:when test="number(saleprice)=0">
    						<xsl:value-of select="format-number(price, '###0.00')" />
    					</xsl:when>
    				  <xsl:otherwise>
    					<xsl:value-of select="format-number(saleprice, '###0.00')" />
    				  </xsl:otherwise>
    				</xsl:choose>
    			</xsl:if>
    
              </g:price>

  2. #2
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Hi

    I had to read your question a few times to figure out what I think your issue is. If I understand correctly you are seeing both min qty * price and the price concatenated within the googlebase price field?

    If that's the problem, then I think it's due to your outer 'if' statement. In the first instance you are checking if min qty is greater than 0, then in the second case you are checking if it is not equal to 0.

    So, in the case when min qty = 5, you'll get both if statements resulting in a true result and therefore will get two prices generated.

    The fix is something like this (not tested)
    Code:
    <g:price>		
       <xsl:choose>
    	<xsl:when test="minimumquantity &gt; 1">
    		<xsl:choose>
    			<xsl:when test="number(saleprice)=0">
    				<xsl:value-of select="format-number(price * minimumquantity, '###0.00')" />
    			</xsl:when>
    			<xsl:otherwise>
    				<xsl:value-of select="format-number(saleprice * minimumquantity, '###0.00')" />
    			</xsl:otherwise>
    		</xsl:choose>
    	</xsl:when>						
    	<xsl:otherwise>
    		<xsl:choose>
    			<xsl:when test="number(saleprice)=0">
    				<xsl:value-of select="format-number(price, '###0.00')" />
    			</xsl:when>
    			<xsl:otherwise>
    				<xsl:value-of select="format-number(saleprice, '###0.00')" />
    			</xsl:otherwise>
    		</xsl:choose>
    	</xsl:otherwise>
        </xsl:choose>
    </g:price>