Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 09-06-2008 17:42:50

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Mini Mini Cart in skin header

I have a link in the right column of my store header that is an image of a shopping bag, which takes you to the View Shopping Cart page. I would also like to put just the totals beside the shopping bag image in the header, but I'm not sure how to do this.

Any suggestions to get the shopping cart totals displayed in my store header?

Thanks,
Cyndi

Offline

 

#2 09-06-2008 19:38:27

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

If your using the standard mini cart display it should be doing just that, so it sound like you have just hard coded a link to the cart. Where is the site so some one could see?

John

Offline

 

#3 09-06-2008 20:33:03

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

I'm customizing a clone of the Ecommerce skin, and the Mini Cart is normally displayed at the bottom left in a box with a title and a View Cart button. All I want displayed in the header is just the totals. I've tried moving the Mini Cart from the bottom left up into the header in skin.php, but I haven't been able to remove the View Cart button.

You can view my work-in-progress site here:

Thanks,
Cyndi

Offline

 

#4 09-06-2008 22:29:35

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

I removed the View Cart button in the Mini Cart Display, it was in the XHTML Include. Now, I'd like to align the totals to the right of my Shopping Bag image/link, but I'm not having any luck. I still have a lot to learn about code, but I'm trying.

Here's what I edited in skin.php:

Code:

<td id="skin_ht_rcol">

<p><a href="<?php print $link_cart; ?>"title="Shopping Bag"> <img src="<?php print $disp_baseurl; ?>/skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" /> </a>

          <?php /* PHP FUNCTION */
                /* Include the minicart namespace. */
                $skinfunc->namespace($app_id,'minicart'); ?>

     </p>

I probably didn't do it right, but I'm sure you'll let me know! smile

Thanks,
Cyndi

Offline

 

#5 09-07-2008 00:37:43

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

Remove this line from you skin.php and place it in the include for the mini cart

Code:

<p><a href="<?php print $link_cart; ?>"title="Shopping Bag"> <img src="<?php print $disp_baseurl; ?>/skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" /> </a>

you can add it to the line in the mini cart display like

Code:

print '<p><a href="' . $link_cart . '" title="Shopping Bag"> <img src="' . $disp_baseurl . '/skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" /> </a> <strong>Total</strong><a href="' . $link . '" title="View Cart"> ' . $this->xhtml_encode($mini['priced']) . '</a></p>' . $eol;

I just placed it in front of the original code (I beleive since my code is moded quite a bit)

Code:

<strong>Total</strong><a href="' . $link . '" title="View Cart"> ' . $this->xhtml_encode($mini['priced']) . '</a></p>' . $eol;

Remember that the include is php so you need to use print ( print 'put what you want to print between quotes'; ) or another php code that outputs too the page to get the elements printed on the page.

John

Last edited by dh783 (09-07-2008 13:49:20)

Offline

 

#6 09-07-2008 00:45:11

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

You might also look into the css class for the mini cart and change it to an inline display if it isn't already.

John

Offline

 

#7 09-07-2008 00:54:42

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

The code you have in post four is causing the page to error out with 10 errors in the html validator because you are placing a paragraph inside a paragraph which is not allowed which is also causing your problems. If you do what I have in post five it should clear that up.

John

Offline

 

#8 09-07-2008 10:13:38

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

John, thanks so much for your help. I'm a little lost, however, on where to put the line of code for the the Shopping Bag image/link in the Mini Cart Include (from your post #5).

Here's my current include:

Code:

<?php 

$app     = $this->globals('khxc_display.app');
$eol     = $this->globals('khxc.eol');
$mini    = $this->globals('ecom.cart_mini_array');
$link    = $this->link_namespace($app,'viewcart',array());

if (empty($mini['items'])) {

     print '<p>0 Items</p>' . $eol;

} else {

     print '<p>' . $mini['items'] . ' Items</p>' . $eol;

     if (empty($mini['price'])) {

     print '<p>$0.00 Total</p>' . $eol;

} else {
     
     print '<p>' . $this->xhtml_encode($mini['priced']) . ' Total</p>' . $eol;

     } // End of if statement.

     if (!(empty($mini['recur']))) {

          print '<p><strong>Recurring</strong>: ' . $this->xhtml_encode($mini['recurd']) . '</p>' . $eol;

     } // End of if statement.

} // End of if statement.

?>

The above has been edited from the original, to change some text and remove the line to print the view cart button.

I also want to change the font color for just the numbers; do I put that in the Include, or in the allcss?

Thanks,
Cyndi

Last edited by posnpretty (09-07-2008 10:20:59)

Offline

 

#9 09-07-2008 10:30:38

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

Maybe I don't need the if/else statements in the include?

Offline

 

#10 09-07-2008 13:47:15

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

Keeping with the same layout you posted it should look like this:

Code:

<?php 

$app     = $this->globals('khxc_display.app');
$eol     = $this->globals('khxc.eol');
$mini    = $this->globals('ecom.cart_mini_array');
$link    = $this->link_namespace($app,'viewcart',array());

$disp_baseurl = $this->globals('khxc_display.base_url');

if (empty($mini['items'])) {

     print '<p>0 Items</p>' . $eol;

} else {

     print '<p>' . $mini['items'] . ' Items</p>' . $eol;

     if (empty($mini['price'])) {

     print '<p>$0.00 Total</p>' . $eol;

} else {
     
     print '<p><a href="' . $link . '" title="Shopping Bag"><img src="' . $disp_baseurl . '/skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" /> </a>' . $this->xhtml_encode($mini['priced']) . ' Total</p>' . $eol;

     } // End of if statement.

     if (!(empty($mini['recur']))) {

          print '<p><a href="' . $link . '" title="Shopping Bag"><img src="' . $disp_baseurl . '/skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" /> </a><strong>Recurring</strong>: ' . $this->xhtml_encode($mini['recurd']) . '</p>' . $eol;

     } // End of if statement.

} // End of if statement.

?>

this should get what you want.

Changed to include the link in the recurring code line.


John

Last edited by dh783 (09-07-2008 14:21:04)

Offline

 

#11 09-07-2008 14:04:08

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

John, I copied & pasted your code from post #10 in place of my code for the Mini Cart Include. Unfortunately, something is amiss. There is no image of the shopping bag now, but instead just the words "Shopping Bag" that are a clickable link. That link takes you back to the Home page, not the View Cart page.

Sorry to be so much trouble. I have been trying to learn PHP, but the online tutorials I have found assume that I have some coding experience, which I do not. So, it's slow going.

Thanks,
Cyndi

Offline

 

#12 09-07-2008 14:16:54

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

What I am trying to accomplish is to have the image of the shopping bag always showing in the header, and it should be a clickable image that takes you to the View Cart page. To the right of the image should be the totals. Above the totals it would be nice to also have clickable text "Shopping Bag" that also takes you to the View Cart page.

Maybe my skin.php is still wrong; I removed the line that was showing my Shopping Bag image as a link (per your post #5). This is the result in my skin.php for the header right column:

Code:

<td id="skin_ht_rcol">

          <?php /* PHP FUNCTION */
                /* Include the minicart namespace. */
                $skinfunc->namespace($app_id,'minicart'); ?>

Thanks,
Cyndi

Offline

 

#13 09-07-2008 14:22:36

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

No I didn't add a reference to the base url or chang the link varaible to the cart which I have done in the previous post.

John

Offline

 

#14 09-08-2008 14:46:36

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

John, thanks so much for the revised code. This is somewhat closer to what I wanted, but for a few issues:

1. When there are no items in the cart, the Shopping Bag image/link does not show. I would prefer that the shopping bag image/link always be showing in the header, even when there are no items in the cart. I tried adding the same print image/link code to the 'if empty' Total line as you did for the 'else' Total line. However, this did not work - the image/link still does not show if there are no items in the cart.

2. Another problem is the large space between the # of Items and the $ Total. I would prefer that these lines be closer.

3. Another minor problem is that when the Total is $0.00, that line does not show up.

View my work-in-progress site here: 
You are welcome to add/delete products from the shopping cart to see the way the Mini Cart displays with different scenarios.

Thanks so much; hopefully, with your help I will get this worked out soon.

Cyndi

Last edited by posnpretty (09-08-2008 15:29:03)

Offline

 

#15 09-08-2008 23:09:32

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

See if this one works better for you:

Code:

<?php 

$app     = $this->globals('khxc_display.app');
$eol     = $this->globals('khxc.eol');
$mini    = $this->globals('ecom.cart_mini_array');
$link    = $this->link_namespace($app,'viewcart',array());

$disp_baseurl = $this->globals('khxc_display.base_url');

print '<p><a href="' . $link . '" title="Shopping Bag"><img src="' . $disp_baseurl . '/skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" /> </a> ';

if (empty($mini['items'])) {

     print '0 Items</p>' . $eol;

} else {

     print $mini['items'] . ' Items</p>' . $eol;

     print '<p>';

     if (empty($mini['price'])) {

        print '$0.00 Total</p>' . $eol;

     } else {
     
        print $this->xhtml_encode($mini['priced']) . ' Total</p>' . $eol;

     } // End of if statement.

     if (!(empty($mini['recur']))) {

          print '<p><strong>Recurring</strong>: ' . $this->xhtml_encode($mini['recurd']) . '</p>' . $eol;

     } // End of if statement.

} // End of if statement.

?>

John

Offline

 

#16 09-09-2008 00:59:44

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

John, thanks very much - this is looking much better. Your code fixed problems #1 and #2 (from my post #14). Now the shopping bag image/link always shows, even if there are no items in the cart. And, the large space between the total lines is gone.

There are only two more issues:

1. When there are no items in the cart, I would like to have BOTH '0 Items' and '$0.00 Total' showing. So far, only '0 Items' shows. Is there something wrong with this code, that prevents the '$0.00 Total' from showing?

Code:

 if (empty($mini['price'])) {

        print '$0.00 Total</p>' . $eol;

2. Right now, the 'Your Shopping Bag' line is aligned with the bottom of the shopping bag image/link, as shown in the screenshot below:

http://purplepeacock.com/images/skinheadershoppingbag1.png

Is there any way to get it aligned with the top of the bag, and then have the Items and Total lines line up under the 'Your Shopping Bag' line? As in this mock-up image:

http://purplepeacock.com/images/skinheadershoppingbag2.png
(Note: I added the 'Your Shopping Bag' link to your code in post #15, but the bottom-alignment problem was there before I added it.)

Here's my current code:

Code:

<?php 

$app     = $this->globals('khxc_display.app');
$eol     = $this->globals('khxc.eol');
$mini    = $this->globals('ecom.cart_mini_array');
$link    = $this->link_namespace($app,'viewcart',array());

$disp_baseurl = $this->globals('khxc_display.base_url');

print '<p><a href="' . $link . '" title="Shopping Bag"><img src="' . $disp_baseurl . '/skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" /> </a> ';

print '<a href="' . $link . '" title="Your Shopping Bag">Your Shopping Bag</a> </p> ';

if (empty($mini['items'])) {

     print '<p>0 Items</p>' . $eol;
     
} else {

     print $mini['items'] . ' Items</p>' . $eol;

     print '<p>';

     if (empty($mini['price'])) {

        print '$0.00 Total</p>' . $eol;

     } else {
     
        print $this->xhtml_encode($mini['priced']) . ' Total</p>' . $eol;

     } // End of if statement.

     if (!(empty($mini['recur']))) {

          print '<p>: ' . $this->xhtml_encode($mini['recurd']) . '<strong>Recurring</strong></p>' . $eol;

     } // End of if statement.

} // End of if statement.

?>

Thanks so much for your continued help, John!

Cyndi

Last edited by posnpretty (09-09-2008 01:18:35)

Offline

 

#17 09-09-2008 10:13:13

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

With what you added you will need to make another edit as when you have items in the cart you will break the html because you will end up with more closing paragraph tags than you have opened. The $ in the line for zero amount needs to be either escaped (\$)or entered in html code (&# 36 ; except with out spaces) I entered the html code in post 15 but the forum translated it into $, so that didn't help. You also need to remove a / in the line for the bag picuture since it is getting built with two slashes (//skin...). Getting the shopping bag text to the top of the picture could be as simple as adding an entry to the css class for that display or you may need to seperate the picture and the words into deferent table cells. Here is a revised code:

Code:

<?php 

$app     = $this->globals('khxc_display.app');
$eol     = $this->globals('khxc.eol');
$mini    = $this->globals('ecom.cart_mini_array');
$link    = $this->link_namespace($app,'viewcart',array());

$disp_baseurl = $this->globals('khxc_display.base_url');

print '<p><a href="' . $link . '" title="Shopping Bag"><img src="' . $disp_baseurl . 'skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" /> </a> ';

print '<a href="' . $link . '" title="Your Shopping Bag">Your Shopping Bag</a> </p> ';

if (empty($mini['items'])) {

     print '<p>0 Items</p>' . $eol;
     
} else {

     print '<p>' . $mini['items'] . ' Items</p>' . $eol;

     print '<p>';

     if (empty($mini['price'])) {

        print '\$0.00 Total</p>' . $eol;

     } else {
     
        print $this->xhtml_encode($mini['priced']) . ' Total</p>' . $eol;

     } // End of if statement.

     if (!(empty($mini['recur']))) {

          print '<p>: ' . $this->xhtml_encode($mini['recurd']) . '<strong>Recurring</strong></p>' . $eol;

     } // End of if statement.

} // End of if statement.

?>

John

Offline

 

#18 09-10-2008 13:07:55

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

dh783 wrote:

The $ in the line for zero amount needs to be either escaped (\$)or entered in html code (&# 36 ; except with out spaces) I entered the html code in post 15 but the forum translated it into $, so that didn't help.

I tried both the escape (\$) and the html code for the $ sign, but neither one worked. sad
Do you have any other suggestions for getting the $ sign to display?

You also need to remove a / in the line for the bag picuture since it is getting built with two slashes (//skin...).

Thanks for catching this, John. I have made the change.

Getting the shopping bag text to the top of the picture could be as simple as adding an entry to the css class for that display or you may need to seperate the picture and the words into deferent table cells.

I finally managed to get the text aligned closer to the top, and the skin header now looks much better. Here's the changes I made in order to accomplish this; although it is working for me IE and FF, please let me know if (once again) I made coding errors!

I moved the shopping bag image/link to the skin.php file, and enclosed it along with the Mini Cart function in div tags:

Code:

<td id="skin_ht_rcol">

   <div id="bagimage">
              <p><a href="http://www.purplepeacock.com/khxc/index.php?app=ccp0&amp;ns=viewcart" title="Shopping Bag"><img 

src="http://www.purplepeacock.com/khxc/skins/ppskin/media/ppshoppingbagtrans39x50.png" width="39" alt="Shopping Bag" height="50" 

/> </a></p>

              <?php /* PHP FUNCTION */
                /* Include the minicart namespace. */
                $skinfunc->namespace($app_id,'minicart'); ?>

    </div>

I also added two div classes to the all.css file for my skin:

Code:

#bagimage {
    float: right;
    width: 150px;
}
#bagimage img {
    float: left;
}

Then I removed the print line for the shopping bag image/link from the Mini Cart Display include, so now the include is coded:

Code:

<?php 

$app     = $this->globals('khxc_display.app');
$eol     = $this->globals('khxc.eol');
$mini    = $this->globals('ecom.cart_mini_array');
$link    = $this->link_namespace($app,'viewcart',array());

$disp_baseurl = $this->globals('khxc_display.base_url');

print '<p> <a href="' . $link . '" title="Your Shopping Bag">Your Shopping Bag</a> </p> ';

if (empty($mini['items'])) {

     print '<p>0 Items</p>' . $eol;
     
} else {

     print '<p>' . $mini['items'] . ' Items</p>' . $eol;

     print '<p>';

     if (empty($mini['price'])) {

        print '($0.00 Total</p>' . $eol;

     } else {
     
        print $this->xhtml_encode($mini['priced']) . ' Total</p>' . $eol;

     } // End of if statement.

     if (!(empty($mini['recur']))) {

          print '<p>: ' . $this->xhtml_encode($mini['recurd']) . '<strong>Recurring</strong></p>' . $eol;

     } // End of if statement.

} // End of if statement.

?>

I left this line in the Include, just in case I did something wrong and need it back in there:

Code:

$disp_baseurl = $this->globals('khxc_display.base_url');

If my other changes were okay, then should I delete the above line from the Include?

With the changes I have made, the bag image and Mini Cart text now display correctly for me in IE7 and FF2. However, since I am such a novice to coding, will you please let me know if any of my changes might cause other problems?

Also, please let me know if you have any other suggestions for getting the $ sign to display.

Thanks,
Cyndi

Last edited by posnpretty (09-10-2008 13:12:19)

Offline

 

#19 09-10-2008 14:06:31

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

The code line you posted in your last entry has a ( in the line for zero amount

Code:

print '($0.00 Total</p>' . $eol;

it should work like

Code:

print '\$0.00 Total</p>' . $eol;

or

Code:

 print '&#36 ;0.00 Total</p>' . $eol;

(no space between 36 and ; )


What item in the site do you have that has a zero sale amount?

John

Last edited by dh783 (09-10-2008 14:08:22)

Offline

 

#20 09-10-2008 14:28:44

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

dh783 wrote:

The code line you posted in your last entry has a ( in the line for zero amount

Code:

print '($0.00 Total</p>' . $eol;

Oops! I don't know how that "(" got in there...but I tried both of your posted lines of code, and neither works to display the $ Total if there are no items in the cart.

What item in the site do you have that has a zero sale amount?

I don't have any items in the site (none of my own products are loaded yet) that have a zero sale amount. Are you saying that when there are no items in the cart, the $ Total will not display? If that is normal behavior, then I'm okay with that.

Did you find any other problems?

Thanks,
Cyndi

Offline

 

#21 09-10-2008 15:28:28

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

With the way you have your if statements the $0.00 will only display when there are items in the cart which have no value. With no items in the cart the if statement end here

Code:

if (empty($mini['items'])) {

     print '<p>0 Items</p>' . $eol;
     
} else {

when there are item in the cart then it goes here

Code:

     print '<p>' . $mini['items'] . ' Items</p>' . $eol;

     print '<p>';

at this point it check to see if there is an amount in the cart, if not it prints 0.00 if there is it prints that amount. If you want the zero amount to show when no items are in the cart you will need to place a copy of the zero price code in the first part:

Code:

if (empty($mini['items'])) {

     print '<p>0 Items</p>' . $eol;

     print '<p>\$0.00 Total</p>' . $eol;

     } else {

John

Offline

 

#22 09-10-2008 15:37:25

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

dh783 wrote:

If you want the zero amount to show when no items are in the cart you will need to place a copy of the zero price code in the first part:

Code:

if (empty($mini['items'])) {

     print '<p>0 Items</p>' . $eol;

     print '<p>\$0.00 Total</p>' . $eol;

     } else {

Well, DUH! I can't believe I missed that, except that I have so little experience with PHP. THANK YOU, John!

What about the changes I made to the skin.php and all.css files, that I posted in #18? Did I mess anything up there?

Thanks,
Cyndi

Offline

 

#23 09-10-2008 16:26:18

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Mini Mini Cart in skin header

Your fine with what you have, you can always check your html code here http://validator.w3.org/

John

Offline

 

#24 09-10-2008 16:54:07

posnpretty
Member
From: Kentucky
Registered: 05-04-2008
Posts: 130
Website

Re: Mini Mini Cart in skin header

Thanks, John. I've been checking my html using the FireFox Web Developer add-in, but I wasn't sure how accurate it is.

Thanks again for your help, and your PATIENCE! smile

Cyndi

Offline

 

Board footer