Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 change font color in cart
Author « Topic »  

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 08/20/2019 :  07:22:12  
I can change the font color using HTML on the product description and it shows up in the product pages. However, it does not carry through to the cart check page. Is it possible to do so?

dbdave
ECT Moderator

USA
10276 Posts

Posted - 08/20/2019 :  08:05:26  
Hi, can you be specific on what info you are changing, and how you are going about that?
Is it the product ID, or name?

Phil
ECT Moderator

United Kingdom
7621 Posts

Posted - 08/20/2019 :  08:14:01  
Hi Roger,
If you're referring to the product ID, product name and price text that displays for the item you have added to cart you can set the color and font size using something like the line below in your ectstyle.css file

div.cartline{color: #ff0000; font-weight:bold; font-size: 14px;}

Or if it's just individual text that you want to format let me know which parts



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 08/20/2019 :  08:33:33  
Only the promotional items they would like to have a different color on. For instance I have in the Prod Name: <strong><font color="red">NEW ITEM! 25% off promotion!</font></strong><p> Maple Bacon Syrup!</p> This will give it a red color in the product area. This does not carry over to the cart for that particular item. If I understand you correctly it cannot be done per item level, just global level?

dbdave
ECT Moderator

USA
10276 Posts

Posted - 08/20/2019 :  08:39:40  
I don't think you should be adding HTML markup there. It's likely to have a negative impact in other areas.
html markup is stripped in some areas and that's why you are seeing it carried over to the cart.

There would be better ways to do that.
For the cart page, you can USE javascript to locate and make style changes without needing HTML markup on the product name.

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 08/20/2019 :  08:47:04  
The HTML markup is working well through out the web site, however the HTML markup does NOT show up in red during checkout. The HTML does not work. Phil is saying to use the ectstyle.css to make the changes but that will only work on every item in the cart, not the special promotional items. Perhaps there is a way to state for item number XXX change font to red.

dbdave
ECT Moderator

USA
10276 Posts

Posted - 08/20/2019 :  08:58:55  
Yes, you can use javascript to check for any part of that product ID or name and then take action.
Have you check to see what's happening with that markup on your email receipts, and in the admin. What about your printed receipts? How does it look there?

With javascript, I am not sure how proficient you are, but you would create an iteration to look trough that products in the cart, find a match, and then change the styling there.
If you have a number of products there that you want use this, then I would suggest you have some unique text in the product name that the javascript will look for.

Although it's outside the scope of the fourm, if you need help with the javascript, let me know and I will take a look later and help you get it working.




Edited by - dbdave on 08/20/2019 09:00:48

Phil
ECT Moderator

United Kingdom
7621 Posts

Posted - 08/20/2019 :  09:27:26  
quote:
For instance I have in the Prod Name: <strong><font color="red">NEW ITEM! 25% off promotion!</font>

You really need to remove that. Dave is quite correct



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

Phil
ECT Moderator

United Kingdom
7621 Posts

Posted - 08/20/2019 :  10:10:25  
Hi Roger,
Adding this to the cart.php file should do it in the <head> section - use the editable region section

<script>
$(document).ready(function() {
$('div.cartline:contains("NEW ITEM")').css('color', 'red');
});
</script>



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 08/20/2019 :  10:27:42  
I tried it but didnt work.

<?php
session_cache_limiter('none');
session_start();
ob_start();
include "vsadmin/db_conn_open.php";
include "vsadmin/inc/languagefile.php";
include "vsadmin/includes.php";
include "vsadmin/inc/incfunctions.php";
?><!DOCTYPE html>
<html lang="en"><!-- InstanceBegin template="/Templates/waldenfarmsb2c.dwt" codeOutsideHTMLIsLocked="false" -->
<script>
$(document).ready(function() {
$('div.cartline:contains("NEW ITEM")').css('color', 'red');
});
</script>
<head>

Phil
ECT Moderator

United Kingdom
7621 Posts

Posted - 08/20/2019 :  10:41:53  
Hi Roger,
You didn't place it in the correct place. I've added it and it works - see below for the correct placement

<!-- InstanceBeginEditable name="head" -->
<script>
$(document).ready(function() {
$('div.cartline:contains("NEW ITEM")').css('color', 'red');
});
</script>



<!-- InstanceEndEditable -->



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

Edited by - Phil on 08/27/2019 07:52:36

dbdave
ECT Moderator

USA
10276 Posts

Posted - 08/20/2019 :  10:44:54  
I love that script Phil posted... short and sweet.
But it looks like jquery, so you would need to be calling jquery and then this script would need to be placed after the jquery call.

EDIT - OR NOT... lol

Looks like it's working...

Edited by - dbdave on 08/20/2019 10:47:43

dbdave
ECT Moderator

USA
10276 Posts

Posted - 08/20/2019 :  10:48:34  
Love it Phil...

ardade
Advanced Member

257 Posts

Pre-sales questions only
(More Details...)

Posted - 08/20/2019 :  10:49:04  
Thanks its working!

dbdave
ECT Moderator

USA
10276 Posts

Posted - 08/20/2019 :  11:19:04  
Thanks Phil. I will surely save this in my toolbox.
Being a novice javascript guy, I guess this is some newer ES6 javascript shorthand...
I guessed we would need to do an iteration and handle each line of the cart individually.

Vince
Administrator

42466 Posts

Posted - 08/27/2019 :  08:17:11  

dbdave
ECT Moderator

USA
10276 Posts

Posted - 08/27/2019 :  08:56:37  
Well Vince, I thought so too, but I thought Phil posted that jquery was not needed for it to work... Although I don't see that in the thread now.

Phil
ECT Moderator

United Kingdom
7621 Posts

Posted - 08/27/2019 :  09:52:50  
It's required



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

dbdave
ECT Moderator

USA
10276 Posts

Posted - 08/27/2019 :  09:56:52  
Thank Phil, that clears it up.
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.05 seconds. Snitz Forums 2000