See below for separate instructions for .asp and .php
DEMO---
You can see it working on my test site here - http://www.floridasurpluswarehouse.com/flsurplus/dev/proddetail.php?prod=keyboard001
That is a link to a product that has a PROP65 warning.
If you load that product into a cart and proceed with a California shipping address, you will see the warning in checkout.
For decades California has had Prop (Proposition) 65 in place. It dates back to the 80's.
This has to do with product warnings and clean water mostly. Over the years, it has been expanded and many chemicals have been added to the list. In 2016 big changes were made that became active in August 2018. This expanded the warnings to (among other places) websites.
There is tons of info out there and it can be difficult to understand the products that might need warnings.
I can tell you that according to the Official website ( https://www.p65warnings.ca.gov/new-proposition-65-warnings ) if you have under 10 employees, you do not need to show warnings.
I do have more than 10 employees at my company, so I personally must understand this and attempt to comply.
There was a good article that came out just prior to the August 2018 enactment here - https://www.techtransactionstoday.com/2018/05/31/your-webpage-is-about-to-violate-the-law-and-other-changes-to-prop-65-warning-requirements/
It's actually scary to think that there are so called bounty hunters out there looking to turn in companies who do not comply.
In the past, with regards to product packaging, it seems these bounty hunters are real.
So even if you do not have 10+ employees, you might consider using this.
Hey, it may give the appearance that you are a large company, driving additional shopper confidence.
Here is an excerpt from the article that pertains to websites.
quote:
The New “Gotcha” – Internet and Catalog Warnings
Historically, for product purchases made over the internet, a company needed to provide only a general broad warning at the bottom of the company website to comply with Prop 65 or have a compliant label on the product being sold (even if not seen by the purchaser). No more.
Now, each product that requires a warning must have that warning “closely associated” with it on the product webpage. OEHHA has provided guidance on how internet retailers can comply with the new regulations. Specifically, website warnings must either be (1) placed on the product’s display page, (2) given via hyperlink using the word “WARNING” placed on the product display page, or (3) displayed, with a tie to the product for which the warning is being given, to the consumer before the purchase is completed (such as having the warning appear when the shopper enters a California zip code into the shipping information fields during the checkout process). A warning does not satisfy Prop 65’s requirements if the purchaser is required to search for it.
What I have done is create a two pronged solution that you can implement that should allow you to comply.
The big piece is a warning on the final checkout page where we will detect that the order is shipping to the state of California and a product you have marked as needing a warning, exists on the order.
IMAGE EXAMPLE
(download a warning image here - https://www.p65warnings.ca.gov/warning-symbol )
The next piece is a warning on the product details page itself. This would be optional, but easy to create.
I have done this in a way that will not be affected by updates.
The steps below need to be followed carefully. It's quite easy to remove the changes, and everything is commented so you can spot the changes in your pages later on.
I have tried to consider the different ways a store may be setup and plan for that. For example if you are not forcing users to supply a shipping address, then the billing address will be used to determine if the order is shipping to California.
I can't be sure how this will work if you are using some payment processors that may bypass some checkout steps such as paypal express.
I can tell you it works fine with paypal standard and when payments are entered on your site.
Please test your checkout thoroughly after implementing this to be sure everything is working as expected.
It's also possible this may have other purposes. You could actually change the state and have a message show up for a different state.
On with it...
BEGIN :::ASP VERSION:::STEP 1We will use an existing field on your last checkout page to add a hidden div where we will show the message when ready, via javascript.
There is a message that comes from the languagefile and we will copy that to the includes.asp file with a small addition like so.
(add this entire line, below, to your includes)xxChkCmp="<div id=""prop65warn""></div>Check totals and proceed to process payment."The bit in red there is what we have added. If you happen to already have that in your includes (maybe you wanted to edit that text) then just add the part in red.
While you are in your includes file, we need to activate the custom3 field for your products, if you do not already use it.
If you already use it, then do nothing. If you are not using it, then add this to your includes file.
( https://www.ecommercetemplates.com/help/ecommplus/parameters.asp#csslayout )
You will need to have custom3 somewhere in "your" detailpagelayout list there (your list may be different than this one)
quote:
detailpagelayout="navigation, checkoutbutton, productimage, productid, manufacturer, sku, productname, discounts, instock, description, listprice, price, quantity, currency, dateadded, options, custom3, addtocart, previousnext, emailfriend, reviews"
To add the custom field names to the product admin page use
admincustomlabel3="PROP65 "
STEP 2Open your cart.asp page in your favorite HTML editor. (I like notepad++ )
In the content area of the page, you will have the include line that allows the cart to show on your page
<!--#include file="vsadmin/inc/inccart.asp"-->AFTER THAT - Important, the code will not work unless it comes after that include line.
Add the following
<!-- begin prop 65-->
<% if orderid<>"" then %>
<div id="hiddednprop65" style="display:none;"><img src="images/prop65warn.png" alt="Prop65 Warning" /><span style="font-weight:bold;">PROP65 WARNING<br/>Add your own message or html here</span></div>
<%
Dim sSQL2, rs165, rs265, conn, sessid, prop65id, showthewarn, prodprop65, fndmtch
prodprop65 = ""
fndmtch = ""
Set rs165=Server.CreateObject("ADODB.RecordSet")
Set rs265=Server.CreateObject("ADODB.RecordSet")
Set conn=Server.CreateObject("ADODB.Connection")
conn.open sDSN
on error resume next
sessid=Request.Cookies("ectcartcookie")
sSQL2 = "SELECT cartProdID,cartSessionID FROM cart WHERE cartSessionID='"&sessid&"'"
rs165.open sSQL2,conn,0,1
do while NOT rs165.EOF
prop65id = rs165("cartProdID")
sSQL2="SELECT pID, pCustom3 FROM products WHERE pID ='"&prop65id&"'"
rs265.Open sSQL2,conn,0,1
fndmtch = ucase(rs265("pCustom3"))
if InStr(fndmtch,"PROP65") > 0 then prodprop65 = "yes"
do while NOT rs265.EOF
rs265.MoveNext
loop
rs265.Close
rs165.movenext
loop
rs165.close
set rs265 = nothing
conn.Close
set rs165 = nothing
set conn = nothing
if ordShipState = "" and ordState="California" and prodprop65<>"" then
showthewarn = "yes"
elseif ordShipState = "California" and prodprop65<>"" then
showthewarn = "yes"
else
showthewarn = ""
end if
%>
<script>
var showthewarn = '<%=showthewarn%>';
if (showthewarn >'') {
document.getElementById('prop65warn').innerHTML = document.getElementById('hiddednprop65').innerHTML;
}
</script>
<%end if%>
<!-- end prop 65-->
There are a few notes regarding the code above. There is a section of HTML there that you will edit to create your custom warning.
I can't specifically tell you what your warning might need to say, you should determine that based on your products and the requirements of the state of California. The part in blue there is what you want to edit. Be sure to leave the outer div intact there so the code works.
Next, we are using the custom3 field from your products to tell the code that the order has an item that needs a prop65 warning.
If you are already using it, no worries, I have that covered below in next steps.
Upload that saved file to your server and before moving to next steps, load a shopping cart at your website to be sure your cart page is loading and working ok. You will not see any PROP65 message at this point.
STEP 3The next step is to add the PROP65 trigger to your products.
The nice thing about using the custom3 field is that you can populate this field quickly with the admin quick entry or via csv download/upload
For now, just open a product in your admin and you should see the custom3 field there.
The code just looks for the word prop65 in there somewhere.
What we will enter there is the following
<div id="prop65warn"></div>This will be hidden from showing on your product detail page and allow the code on the cart page to see that this product needs a warning.
If you are already using the custom3 field, no worries, just add that in front of what you already have there.
<div id="prop65warn"></div>Your existing Custom three infoAt this point you should be able to load that product into a shopping cart and proceed to your checkout and enter a shipping address to the state of California, and you should see your warning appear.
That's all there is to it.
*******************************************************************************************If you want to show a message on your product detail page, follow these instructions
Open your proddetail.asp page in your favorite HTML editor. (I like notepad++ )
In the content area of the page, you will have the include line that allows the product details to show on your page
<!--#include file="vsadmin/inc/proddetail.asp"-->AFTER THAT - Important, the code will not work unless it comes after that include line.
Add the following
<!-- begin prop 65-->
<div id="hiddednprop65" style="display:none;"><img src="images/prop65warn.png" alt="Prop65 Warning" /><span style="font-weight:bold;">PROP65 WARNING<br/>Add your own message or html here</span></div>
<%
Dim sSQL2, rs165, cust3check, prodprop65
cust3check = ""
prodprop65 = ""
Set rs165=Server.CreateObject("ADODB.RecordSet")
Set conn=Server.CreateObject("ADODB.Connection")
conn.open sDSN
on error resume next
sSQL2="SELECT pCustom3 FROM products WHERE pID ='"&prodID&"'"
rs165.Open sSQL2,conn,0,1
cust3check = ucase(rs165("pCustom3"))
if InStr(cust3check,"PROP65") > 0 then prodprop65 = "yes"
rs165.Close
conn.Close
set rs165 = nothing
set conn = nothing
%>
<script>
if (document.getElementById('prop65warn')) {
var showthewarn = '<%=prodprop65%>';
if (showthewarn >'') {
document.getElementById('prop65warn').innerHTML = document.getElementById('hiddednprop65').innerHTML;
}}
</script>
<!-- end prop 65-->
Just like the steps above you will need to customize the html to your liking.
The warning will show on your product detail page in the space where you have defined "custom3" in your includes.
END ASP
*******************************************************************************************************
:::BEGIN PHP VERSION:::
STEP 1We will use an existing field on your last checkout page to add a hidden div where we will show the message when ready, via javascript.
There is a message that comes from the languagefile and we will copy that to the includes.asp file with a small addition like so.
(add this entire line, below, to your includes)$GLOBALS['xxChkCmp']='<div id="prop65warn"></div>Check totals and proceed to process payment.';The bit in red there is what we have added. If you happen to already have that in your includes (maybe you wanted to edit that text) then just add the part in red.
While you are in your includes file, we need to activate the custom3 field for your products, if you do not already use it.
If you already use it, then do nothing. If you are not using it, then add this to your includes file.
( https://www.ecommercetemplates.com/phphelp/ecommplus/parameters.asp#csslayout )
You will need to have custom3 somewhere in "your" detailpagelayout list there (your list may be different than this one)
quote:
$detailpagelayout='navigation,productimage,productname,instock,custom3,description,sku,listprice,price,currency,options,quantity,addtocart,socialmedia,previousnext,reviews';
To add the custom field names to the product admin page use
admincustomlabel3="PROP65 "
STEP 2Open your cart.php page in your favorite HTML editor. (I like notepad++ )
In the content area of the page, you will have the include line that allows the cart to show on your page
<?php include "vsadmin/inc/inccart.php" ?>AFTER THAT - Important, the code will not work unless it comes after that include line.
Add the following
<!-- begin prop 65-->
<?php if ($orderid) : ?>
<div id="hiddednprop65" style="display:none;"><img src="images/prop65warn.png" alt="Prop65 Warning" /><span style="font-weight:bold;">PROP65 WARNING<br/>Add your own message or html here</span></div>
<?php
$prodprop65 = '';
$fndmtch = '';
$sessid = $_COOKIE["ectcartcookie"] ;
$sSQL2="SELECT cartProdID,cartSessionID FROM cart WHERE cartSessionID='".$sessid."'";
$result=ect_query($sSQL2) or ect_error();
if(ect_num_rows($result)>0){
while($rs=ect_fetch_assoc($result)){
$prop65id = $rs['cartProdID'];
$sSQL2="SELECT pID, pCustom3 FROM products WHERE pID ='".$prop65id."'" ;
$result2=ect_query($sSQL2) or ect_error();
while($rs2=ect_fetch_assoc($result2)){
$fndmtch = strtoupper($rs2['pCustom3']);
$findme = 'PROP65';
$pos = strpos($fndmtch, $findme);
if ($pos !== false) {
$prodprop65 = 'yes';
}}}
ect_free_result($result);
ect_free_result($result2);
}
if (($ordShipState == '') && ($ordState=='California') && ($prodprop65!=='')) {
$showthewarn = 'yes';
} elseif (($ordShipState == 'California') && ($prodprop65!=='')) {
$showthewarn = 'yes';
} else {
$showthewarn = '';
}
?>
<script>
var showthewarn = '<?php print $showthewarn;?>';
console.log ('show the warn is '+showthewarn);
if (showthewarn >'') {
document.getElementById('prop65warn').innerHTML = document.getElementById('hiddednprop65').innerHTML;
}
</script>
<?php endif ?>
<!-- end prop 65-->
There are a few notes regarding the code above. There is a section of HTML there that you will edit to create your custom warning.
I can't specifically tell you what your warning might need to say, you should determine that based on your products and the requirements of the state of California. The part in blue there is what you want to edit. Be sure to leave the outer div intact there so the code works.
Next, we are using the custom3 field from your products to tell the code that the order has an item that needs a prop65 warning.
If you are already using it, no worries, I have that covered below in next steps.
Upload that saved file to your server and before moving to next steps, load a shopping cart at your website to be sure your cart page is loading and working ok. You will not see any PROP65 message at this point.
STEP 3The next step is to add the PROP65 trigger to your products.
The nice thing about using the custom3 field is that you can populate this field quickly with the admin quick entry or via csv download/upload
For now, just open a product in your admin and you should see the custom3 field there.
The code just looks for the word prop65 in there somewhere.
What we will enter there is the following
<div id="prop65warn"></div>This will be hidden from showing on your product detail page and allow the code on the cart page to see that this product needs a warning.
If you are already using the custom3 field, no worries, just add that in front of what you already have there.
<div id="prop65warn"></div>Your existing Custom three infoAt this point you should be able to load that product into a shopping cart and proceed to your checkout and enter a shipping address to the state of California, and you should see your warning appear.
That's all there is to it.
*******************************************************************************************If you want to show a message on your product detail page, follow these instructions
Open your proddetail.php page in your favorite HTML editor. (I like notepad++ )
In the content area of the page, you will have the include line that allows the product details to show on your page
<?php include "vsadmin/inc/incproddetail.php" ?>AFTER THAT - Important, the code will not work unless it comes after that include line.
Add the following
<!-- begin prop 65-->
<div id="hiddednprop65" style="display:none;"><img src="images/prop65warn.png" alt="Prop65 Warning" /><span style="font-weight:bold;">PROP65 WARNING<br/>Add your own message or html here</span></div>
<?php
$prodprop65 = '';
$custthreecheck = '';
$sSQL2="SELECT pCustom3 FROM products WHERE pID ='".$prodid."'";
$result=ect_query($sSQL2) or ect_error();
while($rs=ect_fetch_assoc($result)){
$custthreecheck = strtoupper($rs['pCustom3']);
$findme = 'PROP65';
$pos = strpos($custthreecheck, $findme);
if ($pos !== false) {
$prodprop65 = 'yes';
}}
ect_free_result($result);
?>
<script>
if (document.getElementById('prop65warn')) {
var showthewarn = '<?php print $prodprop65;?>';
if (showthewarn >'') {
document.getElementById('prop65warn').innerHTML = document.getElementById('hiddednprop65').innerHTML;
}}
</script>
<!-- end prop 65-->
Just like the steps above you will need to customize the html to your liking.
The warning will show on your product detail page in the space where you have defined "custom3" in your includes.
END PHP
*******************************************************************************************************NOTE - If you need to style that div where the message shows, or add a float maybe, you can use the selector
#prop65warn in your css file
example
#prop65warn {float:left;}
There are a number of ways to do this and more ways to trigger the warning, but to me, this seems the most universal for most users.
Let me know if you have questions.
Of course this is not endorsed by, or supported by ect.
But I am willing to answer questions and help as I can.
There are no guarantees that this will work for you, but it should. If it doesn't, I'll give you a full refund.
Did I mention it's free?
If there is interest, I can try a .php version. No promises though.
Thanks,
David