You are here:  » show full price and then sale price highlighted underneath

Support Forum



show full price and then sale price highlighted underneath

Submitted by Paul1107 on Wed, 2009-12-16 13:33 in

Hi David,

I tried looking through other threads but just can't find anything that answers my question, which I find suprising, perhaps you can help please?

In prepersation for the sales I was hoping to display the regular price (perhaps crossed through) and then underneath a highlighted sale price.

It is a common feature in other sites and I would image it is achiveable, its just find out our to do it?

I guess that would involve amending the featured.php to add a further field to show the sale price? and would also encompass re-mapping/registering the feeds for the additional field?

is there a previous thread around the same issue, or could you kindly point me in the direction of the solution

Thanks again

Paul

Submitted by support on Wed, 2009-12-16 14:12

Hi Paul,

This will work in a similar way to the shipping / delivery price mods that several users have added. The first stage of course is to add a new field "normalprice" to your installation. I think you're using the latest release, in which case the instructions are here:

http://www.pricetapestry.com/node/3094

(or for the original distribution http://www.pricetapestry.com/node/313

With that in place, and you've been able to re-register a feed and import the normalprice field (don't forget to register the sale price as the normal price field of course!), it would just be a case of displaying the normalprice field where required within the /html/ files. For example, in Featured Products, let's say you want to display the normalprice below the current (sale) price display; in small red text with strikethrough; look for the following block of code in html/featured.php:

          <?php if ($product["numMerchants"] > 1): ?>
            <em><?php print translate("from"); ?></em>&nbsp;<strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("Compare Prices"); ?></a></span>
          <?php else: ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
          <?php endif; ?>

...and REPLACE with:

          <?php if ($product["numMerchants"] > 1): ?>
            <em><?php print translate("from"); ?></em>&nbsp;<strong><?php print $config_currencyHTML.$product["minPrice"]; ?></strong><br />
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("Compare Prices"); ?></a></span>
          <?php else: ?>
            <strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br />
<?php
  if ($product["normalprice"] && ($product["normalprice"] < $product["price"]))
  {
    print "<span style='font-size:x-small;color:red;text-decoration: line-through;'>".$config_currencyHTML.$product["normalprice"]."</span><br />";
  }
?>
            <span class='nobr'><a href='<?php print $product["productHREF"]; ?>'><?php print translate("More Information"); ?></a></span>
          <?php endif; ?>

Hope this helps!

Cheers,
David.

Submitted by Paul1107 on Fri, 2009-12-18 16:44

Hi David,

Sorry I haven't responded ntil now but been away, Thanks for this I'll give it a go over the WE...

Will this way show only when a a sale price is availble?

Thanks again

Paul

Submitted by support on Fri, 2009-12-18 16:54

Hi Paul,

That's right - all you need to do is make sure that when a sale price is available you register that field as the price (so that it appears correctly in the comparison tables), and the non-sale price as the "normalprice" field.

Cheers,
David.

Submitted by Paul1107 on Fri, 2009-12-18 17:26

Hi David,

Re the intructions for adding a field for the original release of PT, just to be clear, should I ignore the first 2 posts and start instruction from the adding the tariff field?

Thanks Paul

Submitted by support on Fri, 2009-12-18 19:14

Hi Paul,

That's right - spot on...

Cheers,
David.

Submitted by Paul1107 on Sat, 2009-12-19 11:43

Hi David

Just setting up on my local server to test, but in setting up a price tapestry installation on my local server I'm having a what I think is a rewrite problem as I can't change the htaccess.txt file to .htaccess. I think that might resolve the issue, do have any ideas?

Regards

Paul

Submitted by Paul1107 on Sat, 2009-12-19 11:59

Hi david,

Its OK I think I've found the solution in /node/909

sorry to trouble you...

Regards

Paul

Submitted by Paul1107 on Sat, 2009-12-19 13:35

Sorry to Pester again David,

But I've carried out the instructions from node/313. However when I try an register a feed, I get the following Parse error message

"Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\mystore\includes\admin.php on line 88"

that refers to the following:

<?php
   $sql 
sprintf("INSERT INTO `".$config_databaseTablePrefix."feeds` SET
                    filename='%s',
                    registered='%s',
                    format='%s',
                    merchant='%s',
                    field_name='%s',
                    field_description='%s',
                    field_image_url='%s',
                    field_buy_url='%s',
                    field_price='%s',
                    field_category='%s',
                    user_category='%s',
                    field_brand='%s',
                    user_brand='%s'
                    field_normalprice='%s',
                    "
,
                    
database_safe($filename),
                    
time(),
                    
database_safe($format),
                    
database_safe(tapestry_normalise(ucwords($merchant),'\.')),
                    
database_safe($fieldName),
                    
database_safe($fieldDescription),
                    
database_safe($fieldImageURL),
                    
database_safe($fieldBuyURL),
                    
database_safe($fieldPrice),
                    
database_safe($fieldCategory),
                    
database_safe(tapestry_normalise($userCategory)),
                    
database_safe($fieldBrand),
                    
database_safe(tapestry_normalise($userBrand))
                    
database_safe($fieldnormalprice/*line 88 */
                    
);
?>

Not sure why this is happening? any help would be appreciated

Regargs

Paul

Submitted by support on Sat, 2009-12-19 13:42

Hi Paul,

There is a comma missing at the end of line 87... it should be:

                    database_safe(tapestry_normalise($userBrand)),

That should be all it is!

Cheers,
David.

Submitted by Paul1107 on Sat, 2009-12-19 14:03

Hi David,

Thanks for that! Did the trick...

All the best!

Paul

Submitted by Paul1107 on Sat, 2009-12-19 14:17

Hi David,

Ran into a small error again, mapped fields for the newly re-registerd feed and all is ok, but when I do a trail register and import, I get the following Warning message at the bottom of the imported items

[INSERT INTO `feeds` SET filename='HOF-Eveningandpartydresses.xml', registered='1261231744', format='xml|MERCHANDISER/PRODUCT/', merchant='HOF Evening And Party Dresses', field_name='PRODUCT-NAME', field_description='DESCRIPTION/LONG', field_image_url='URL/PRODUCTIMAGE', field_buy_url='URL/PRODUCT', field_price='PRICE/SALE', field_category='CATEGORY/PRIMARY', user_category='', field_brand='BRAND', user_brand='' field_normalprice='', ][You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'field_normalprice='',' at line 15]
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\mystore\includes\database.php:52) in C:\xampp\htdocs\mystore\admin\feeds_register_step2.php on line 76

and this is what it relates to:

<?php
if (!widget_errorCount())
    {
      
admin_register($filename,$format,$_POST["merchant"],$_POST["fieldName"], (isset($_POST["fieldDescription"])?$_POST["fieldDescription"]:"")  , (isset($_POST["fieldImageURL"])?$_POST["fieldImageURL"]:"") ,$_POST["fieldBuyURL"],$_POST["fieldPrice"],$_POST["fieldCategory"],$_POST["userCategory"],$_POST["fieldBrand"],$_POST["userBrand"],$_POST["normalprice"]);
      switch(
$_POST["submit"])
      {
        case 
"Register":
          
header("Location: index.php");
          break;
        case 
"Register and Trial Import":
          
header("Location: feeds_import.php?limit=10&filename=".urlencode($filename)); /*This is line 76*/
          
break;
        case 
"Register and Full Import":
          
header("Location: feeds_import.php?limit=0&filename=".urlencode($filename));
          break;
      }
      exit();
?>

any Ideas please?

Thanks again

Paul

Submitted by support on Sat, 2009-12-19 16:22

Hi Paul,

The error is actually referring to the SQL that is constructed in incldues/admin.php.

I can see from the output that there is a comma missing after user_brand and a surplus
one after field_normalprice.

Check that your modification looks something like this:

                    user_brand='%s',
                    field_normalprice='%'
                    ",
                    database_safe($filename),

If you're no sure; if you want to email me your modified
includes/admin.php I'll check all the mods over for you...

Cheers,
David.

Submitted by Paul1107 on Sat, 2009-12-19 17:53

Hi David,

Email Sent

Thanks

Paul

Submitted by Paul1107 on Thu, 2010-03-25 09:35

Hi David,

Just wondered whether you can advise on this as an extension
to the mod you created for me relating to this thread.

All works fine, though I've just noticed that if a feed includes
some sale items but not exclusively, and during the feed
registration mapping I include the sale prices in the "sales price"
field and the higher price in the "normal price" field , I find
that the sale prices show ok, whereas the products at normal price
(non sale items) show as £0.00, and the crossed out price is of
course what they should be selling at.

Possibly it's best shown on this link below

{link saved}

Just thought that an if statement could be only be inserted to
display sale prices if not £0.00?

Regards

Paul

Submitted by support on Thu, 2010-03-25 09:55

Hi Paul,

That should be easily fixed - if you could email me

includes/admin.php
html/searchresults.php

...i'll fix it up for you...

Cheers,
David.