Announcement

Collapse
No announcement yet.

Show lowest price from products in further sections

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Show lowest price from products in further sections

    Hi Forum,

    Basic set-up:

    section level 1 e.g. cars
    section level 2 e.g. ford
    section level 3 e.g. capri
    section level 4 e.g. 1986 Red Capri (Using 1 product per section)

    What I would like to do is whilst viewing section level 1 page (cars) have a price next to each further sub section (i.e. ford) showing the lowest price of all products contained in further sub-categories.

    I imagine this could be done with some cunning blockifs or maybe clientside php, before I attempt this I was wondering if anyone has already done this or knows that it is not possible.

    Thanks

    Alex
    Blog, Twitter, Facebook
    Actinic Ecommerce, CMS and Video production

    www.petraboase.com
    www.progrow.co.uk
    www.christopherpiperwines.co.uk
    www.cheeksandcherries.co.uk
    www.skatewarehouse.co.uk

    #2
    I'd have thought if you run (within the section link layout) a Block on the childsectionlist with the pricelist Block nested inside of that it would give you all prices, you'd then php on those prices to find the lowest. You'd do all that processing on the desktop prior to upload. That'd be my starting point on this.

    Comment


      #3
      Personally I'd probably go with the simplest method of all by just having a fixed value as a variable coded into the design. Something like: 'Prices start from £xx!'

      Comment


        #4
        I know what you mean. I think he wants it reacting to the products within the sections though, because he might show a from price and someone looks inside for that price only to find it's not true.

        Comment


          #5
          Thanks chaps,

          That was roughly what I was thinking but now I know it is possible (hopefully). I shall soldier on...

          Alex
          Blog, Twitter, Facebook
          Actinic Ecommerce, CMS and Video production

          www.petraboase.com
          www.progrow.co.uk
          www.christopherpiperwines.co.uk
          www.cheeksandcherries.co.uk
          www.skatewarehouse.co.uk

          Comment


            #6
            I found this

            Code:
            <actinic:block type="ProductList" >
            <actinic:block type="PriceList" >
            <actinic:block php="true" >
            $pricecount="<actinic:variable name="ListCount" />";
            if ($pricecount=="<actinic:variable name="ListIndex" />")
            echo "Prices from <actinic:variable name="PreFormattedPrice" value="Product Price Excluding Tax" /> +VAT";
            </actinic:block>
            </actinic:block>
            </actinic:block>
            From http://community.actinic.com/showpos...4&postcount=30

            Which works great but only for one section back. Struggling with how to make it work for the section before.

            Alex
            Blog, Twitter, Facebook
            Actinic Ecommerce, CMS and Video production

            www.petraboase.com
            www.progrow.co.uk
            www.christopherpiperwines.co.uk
            www.cheeksandcherries.co.uk
            www.skatewarehouse.co.uk

            Comment


              #7
              Originally posted by leehack View Post
              I'd have thought if you run (within the section link layout) a Block on the childsectionlist with the pricelist Block nested inside of that it would give you all prices, you'd then php on those prices to find the lowest. You'd do all that processing on the desktop prior to upload. That'd be my starting point on this.
              Hi Lee,

              I have been playing with the blockifs to achieve this and getting myself in a right muddle. As the king of blockifs I was wondering if you could give me a little pointer. No worries if you don't have time, I am just starting to go in circles now....

              Alex
              Blog, Twitter, Facebook
              Actinic Ecommerce, CMS and Video production

              www.petraboase.com
              www.progrow.co.uk
              www.christopherpiperwines.co.uk
              www.cheeksandcherries.co.uk
              www.skatewarehouse.co.uk

              Comment


                #8
                Something like this as a basis. N.B. Untested - unsupported - use as guidance only.
                Code:
                <actinic:block php="true">$maxprice=9999999;</actinic:block>
                
                <actinic:block type="ChildSectionList">
                	<actinic:block type="ProductList" >
                		<actinic:block php="true" >
                			$ppraw = <actinic:variable name="ProductPriceRaw" />;
                			if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                		</actinic:block>
                	</actinic:block>
                	<actinic:block type="ChildSectionList">
                		<actinic:block type="ProductList" >
                			<actinic:block php="true" >
                				$ppraw = <actinic:variable name="ProductPriceRaw" />;
                				if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                			</actinic:block>
                		</actinic:block>
                		<actinic:block type="ChildSectionList">
                			<actinic:block type="ProductList" >
                				<actinic:block php="true" >
                					$ppraw = <actinic:variable name="ProductPriceRaw" />;
                					if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                				</actinic:block>
                			</actinic:block>
                		</actinic:block>
                	</actinic:block>
                </actinic:block>
                
                <actinic:block php="true">if ( $maxprice < 9999999 ) echo "From $maxprice";</actinic:block>
                Note that it only goes 3 levels deep from where you place it. Add another block for more. Also final price is displayed with no formatting. And if you use Duplicates, you'll have to use my fix for ProductPriceRaw not being safe there. See http://community.actinic.com/showthread.php?p=306621 - post #11.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  Norman, that is totally fantastic and works a treat!

                  Thanks so much for your help - really appreciate it!

                  Alex
                  Blog, Twitter, Facebook
                  Actinic Ecommerce, CMS and Video production

                  www.petraboase.com
                  www.progrow.co.uk
                  www.christopherpiperwines.co.uk
                  www.cheeksandcherries.co.uk
                  www.skatewarehouse.co.uk

                  Comment


                    #10
                    Wowza! I just typed that lot without checking it in any way. Amazed that it worked first time.
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #11
                      ouch, you are too good.....
                      Blog, Twitter, Facebook
                      Actinic Ecommerce, CMS and Video production

                      www.petraboase.com
                      www.progrow.co.uk
                      www.christopherpiperwines.co.uk
                      www.cheeksandcherries.co.uk
                      www.skatewarehouse.co.uk

                      Comment


                        #12
                        By adding another block do you mean like this...

                        Code:
                        <actinic:block php="true">$maxprice=9999999;</actinic:block>
                        
                        <actinic:block type="ChildSectionList"
                        	<actinic:block type="ProductList" >
                        		<actinic:block php="true" >
                        			$ppraw = <actinic:variable name="ProductPriceRaw" />;
                        			if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                        		</actinic:block>	
                        	</actinic:block>
                        	<actinic:block type="ChildSectionList">
                        		<actinic:block type="ProductList" >
                        			<actinic:block php="true" >
                        				$ppraw = <actinic:variable name="ProductPriceRaw" />;
                        				if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                        			</actinic:block>
                        		</actinic:block>
                        		<actinic:block type="ChildSectionList">
                        			<actinic:block type="ProductList" >
                        				<actinic:block php="true" >
                        					$ppraw = <actinic:variable name="ProductPriceRaw" />;
                        					if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                        				</actinic:block>
                        			</actinic:block>
                        		</actinic:block>
                        		<actinic:block type="ChildSectionList">
                        			<actinic:block type="ChildSectionList">
                        				<actinic:block type="ProductList" >
                        					<actinic:block php="true" >
                        						$ppraw = <actinic:variable name="ProductPriceRaw" />;
                        						if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                        					</actinic:block>
                        				</actinic:block>
                        			</actinic:block>
                        		</actinic:block>		
                        	</actinic:block>
                        </actinic:block>
                        
                        <actinic:block php="true">if ( $maxprice < 9999999 ) echo "From $maxprice";</actinic:block>
                        Blog, Twitter, Facebook
                        Actinic Ecommerce, CMS and Video production

                        www.petraboase.com
                        www.progrow.co.uk
                        www.christopherpiperwines.co.uk
                        www.cheeksandcherries.co.uk
                        www.skatewarehouse.co.uk

                        Comment


                          #13
                          For anyone else wishing to do this, the number formatting can be achieved by changing the last line from

                          Code:
                          <actinic:block php="true">if ( $maxprice < 9999999 ) echo "From $maxprice";</actinic:block>
                          to

                          Code:
                          <actinic:block php="true">if ( $maxprice < 9999999 ) echo"from £".number_format($maxprice,2);</actinic:block>
                          This will add a comma for thousands and show two decimal places

                          Hope this helps
                          Blog, Twitter, Facebook
                          Actinic Ecommerce, CMS and Video production

                          www.petraboase.com
                          www.progrow.co.uk
                          www.christopherpiperwines.co.uk
                          www.cheeksandcherries.co.uk
                          www.skatewarehouse.co.uk

                          Comment


                            #14
                            There's an error in your post #12. Use this instead:
                            Code:
                            <actinic:block type="ChildSectionList">
                            	<actinic:block type="ProductList" >
                            		<actinic:block php="true" >
                            			$ppraw = <actinic:variable name="ProductPriceRaw" />;
                            			if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                            		</actinic:block>
                            	</actinic:block>
                            	<actinic:block type="ChildSectionList">
                            		<actinic:block type="ProductList" >
                            			<actinic:block php="true" >
                            				$ppraw = <actinic:variable name="ProductPriceRaw" />;
                            				if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                            			</actinic:block>
                            		</actinic:block>
                            		<actinic:block type="ChildSectionList">
                            			<actinic:block type="ProductList" >
                            				<actinic:block php="true" >
                            					$ppraw = <actinic:variable name="ProductPriceRaw" />;
                            					if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                            				</actinic:block>
                            			</actinic:block>
                            			<actinic:block type="ChildSectionList">
                            				<actinic:block type="ProductList" >
                            					<actinic:block php="true" >
                            						$ppraw = <actinic:variable name="ProductPriceRaw" />;
                            						if ( ($ppraw != 0) && ($ppraw < $maxprice) ) $maxprice = $ppraw;
                            					</actinic:block>
                            				</actinic:block>
                            			</actinic:block>
                            		</actinic:block>
                            	</actinic:block>
                            </actinic:block>
                            Norman - www.drillpine.biz
                            Edinburgh, U K / Bitez, Turkey

                            Comment


                              #15
                              Norman, fab piece of code, do you mind quickly explaining why it does what it does.

                              I can see that it checks that the value is over 0 and whether it is less than the value already in the variable, if it is then it assigns that value to the variable effectively overwriting the contents.

                              Is that what it is doing, running through all prices and if they are greater than 0 and less than what is already in there, it adds it into there? so by default it will always get to the lowest value, by reiterating against each price?

                              If so that's a clever way of doing it, i like it very much, i'd have been looking to add the prices into some sort of list or array and then picking the lowest from them, this does it so much simpler if i am understanding it correctly.

                              Comment

                              Working...
                              X