Announcement

Collapse
No announcement yet.

Best Seller/New Products

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

    Best Seller/New Products

    When best seller/new products are displayed in the side bar then the text from the product description is also shown. If the product description is more than a few words then the text dispalyed is excessive and if there are several products showing it looks stupid. What is needed is a short product description field which can be used to enter text that is shown when the product is displayed in the side bar or a text limit that cuts the text at say 10 words.

    We all need long product descriptions to generate the food for the search engines, single product pages can have huge descriptions.

    #2
    I believe that Variables can now contain a lot of text.

    So just create one (e.g. BriefDescription) and use it instead of the ProductDescription one in the Layout Code - Mini Product Description.

    Here's a walkthrough on doing just that.

    Go to Design / Library / Variables and highlight Product.

    Now right click and choose New Variable.

    At Basic Definition set the following

    Name: BriefDescription

    Description: Some brief text for the marketing thumbnails.

    Prompt: Brief Description

    Place Of Setting: Product

    Allow <Use Parent> as an Option: Unchecked

    leave all other settings as is.
    OK out.

    Now click the main Design View tab and make sure that the Layout code tab at the bottom is also selected. Click the [><] Icon (just top left of layout window) so that it has an orange background - this gives you the concise view.

    Click within one of the sidebar products. The Layout Code Window should be titled Layout Code - Mini New Product Item.

    Look in that code for the fragment ProductDescription and right-click it - it should turn grey and an options window should appear.

    Choose Insert Variable. Navigate to BriefDescription and Insert it.

    That's it. Your Products will now have a Property tab where you can enter the Brief Description for these sidebar items.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Originally posted by RuralWeb
      What is needed is a short product description field which can be used to enter text that is shown when the product is displayed in the side bar or a text limit that cuts the text at say 10 words.
      The first point can be solved as Norman described above. But the second point can also be done in v8. v8 supports PHP for offline page generation. So you can write a small bit of PHP which cuts the text for you. Just create a new BLOCK tag in the markup and right click to edit its appearance. You will find a PHP item in the grid. If you change it to TRUE then the block's content will be evaluated as a PHP script during page rendering. You can use the Actinic variables in this PHP block just like everywhere in the markup (but the selectable flag is required for these variables). E.g. if you change the variable ProductDescription to the code below then the description will be cut after 10 words.
      Code:
      <actinic:block php="true" >
      $sShort = "";
      $nCount = 0;
      $sOriginal = "<actinic:variable encoding="perl" name="ProductDescription" selectable="false" />"; 
      foreach(explode(" ", $sOriginal) as $sWord)
      	{
         if ($nCount > 10)
         	{
         	$sShort .= "...";
         	break;
         	}
         $sShort .= $sWord . " ";
         $nCount++;
         }
         
      echo $sShort;
      </actinic:block>
      Zoltan
      Actinic Software
      www.actinic.co.uk

      Comment


        #4
        Hi, Zoltan

        I noticed those php=true tags. I wondered what they were for - nothing in the Help as yet.

        Now if I read this right, you've embedded a PHP interpreter into the Actinic executable so that we can process variables and generate code at page compile time.

        If that's correct I'm going to have a lot of fun with that.

        This is a great example of V8 adding not just a little extra functionality but a whole lot of unexpected capability.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          nothing in the Help as yet
          That will all be in the Advanced User Guide - as soon as I get around to writing it.....

          Comment


            #6
            Now if I read this right, you've embedded a PHP interpreter into the Actinic executable so that we can process variables and generate code at page compile time.
            You are correct, that's the case. Originally we have embedded the PHP engine into Catalog for the flexibility of the condition evaluation (yes you can use arbitary PHP expressions in the conditions). Later it was extended to the page generation by having the PHP attribute on the BLOCK tags. You can find examples of its usage in the company logo size, the price format and the push button grid layouts in the default DB. Those are really just very limited examples. This feature provides lot more power IMO. I've got a few more complex ideas to present the flexibility of this feature (like thumbnail image generation on the fly) but nearly at the end of v8 development we got much bigger fish to fry.
            If that's correct I'm going to have a lot of fun with that.
            Good luck with that. I'm already seeing the great extensions coming from you. :-)
            Zoltan
            Actinic Software
            www.actinic.co.uk

            Comment


              #7
              (like thumbnail image generation on the fly)
              yes please

              Comment


                #8
                Thanks for the replies about the shortened text guys - bit late as I missed the posts.

                Comment


                  #9
                  (like thumbnail image generation on the fly)
                  I just stuck this into a Layout

                  Code:
                  <actinic:block php="true" >
                  phpinfo();
                  </actinic:block>
                  and sure enough got the full PHP configuration display.

                  Good to see that the GD image library is in there. That means that dynamic image generation at page compile time should be easy.

                  Now I just need to figure out how I can add this newly created image to the list of files to upload. Any ideas?
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    Now I just need to figure out how I can add this newly created image to the list of files to upload. Any ideas?
                    Just to recap - is this an image that is created on the fly? Will you know the filename of the image in advance?

                    Comment


                      #11
                      Ahh - hang on. Upload has changed in v8 and now Actinic generates the entire site and works out everything it needs to upload, and then uploads it - so any files generated during site generation should be picked up.

                      Comment


                        #12
                        works out everything it needs to upload, and then uploads it - so any files generated during site generation should be picked up.
                        Good news. I presume that this will work for images that are contained in an outer layer created and registered in DW. Do the images have to be in the root directory of site 1 or can they be in a folder within site 1 and still get picked up.

                        Comment


                          #13
                          As far as I know, it's every single file mentioned anywhere in the site.

                          Comment


                            #14
                            Now I just need to figure out how I can add this newly created image to the list of files to upload. Any ideas?
                            As Chris has mentioned correctly this bit was also changed in v8. All the files referenced in the HTML source are automatically picked up and added to the list of files to be uploaded. Therefore if you create a link to the thumbnail image then it will automatically uploaded (if found on the disk).
                            Good to see that the GD image library is in there.
                            It was required for the image size example. But the list of included libraries can be extended by editing php.ini in the Actinic installation folder. However the list of included libraries should be extended carefully because it may have significant effect on the engine initialisation performance.
                            If you are developing functions which are used frequently then you can include them in actinic_main.php which is included all the time when the engine started. However instead of direct inclusion I would suggest your custom code to be in a separated file which is included in actinic_main.php (this will save some time on merging when Actinic changes actinic_main.php).
                            Do the images have to be in the root directory of site 1 or can they be in a folder within site 1 and still get picked up.
                            This function deals with both relative and absolute paths. If you can't wait experiencing it until the Advanced User Guide is out I would suggest to test it yourself by using the "Insert File Name" context menu in the code editor.
                            Zoltan
                            Actinic Software
                            www.actinic.co.uk

                            Comment


                              #15
                              Originally posted by zmagyar
                              The first point can be solved as Norman described above. But the second point can also be done in v8. v8 supports PHP for offline page generation. So you can write a small bit of PHP which cuts the text for you. Just create a new BLOCK tag in the markup and right click to edit its appearance. You will find a PHP item in the grid. If you change it to TRUE then the block's content will be evaluated as a PHP script during page rendering. You can use the Actinic variables in this PHP block just like everywhere in the markup (but the selectable flag is required for these variables). E.g. if you change the variable ProductDescription to the code below then the description will be cut after 10 words.
                              Code:
                              <actinic:block php="true" >
                              $sShort = "";
                              $nCount = 0;
                              $sOriginal = "<actinic:variable encoding="perl" name="ProductDescription" selectable="false" />"; 
                              foreach(explode(" ", $sOriginal) as $sWord)
                              	{
                                 if ($nCount > 10)
                                 	{
                                 	$sShort .= "...";
                                 	break;
                                 	}
                                 $sShort .= $sWord . " ";
                                 $nCount++;
                                 }
                                 
                              echo $sShort;
                              </actinic:block>
                              sorry I am being thick here but could you talk me through how to do this in laymans terms please. Where exactly do I find the markup that I need to insert the block / code into and where do I find the variable ProductDescription

                              Thanks in advance.

                              Comment

                              Working...
                              X