Shopping Cart: Layout questions Shopping Cart: Layout questions
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Shopping Cart: Layout questions

Started by PerformanceImagery, December 31, 2007, 05:57:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PerformanceImagery

I have the Shopping Cart up and running just fine, but would like to make a few slight tweaks to the layout based on the feedback from a few testers for me.  Please reference the attached image to make things easier.

Coppermine v1.4.14
Photo Shop v1.3.5
Final Extract v2.2

1.  I would like to clean up the look of the area circled in orange.  I would like to remove one of the : in front of the prices and I would also like to move the $ to the front of the price amount so that it displays in the correct format for US shoppers. 

2.  I would like to add a Checkout button like the one at the top of the attached image (highlighted in red) in the location next to Empty Basket also highlighted in red.  I think the code for the top checkout button should/could just be entered into this code from the photo_shop_cart.php file...

//the main cart
photoshop_create_cart_form($box);


echo <<<EOT
                <tr>
                        <td align="left" class="tablef" colspan="7">
                            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                                <tr>
                                    <td width="100%" align="center">
                                        <input type="hidden" name="box" value="{$box}" />
EOT;
if ($box=="photo"){ // if we display photos, not cd, then display 'change amounts submit button'
echo <<<EOT
                                        <input type="submit" class="button" name="apply_modifs" value="{$lang_photoshop['save_amounts']}" />
EOT;
}
echo <<<EOT
<input type="submit" class="button" name="empty_basket" value="{$lang_photoshop['empty_basket']}" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                </tr>
EOT;




endtable();
echo '</form>';


But where do I find the code for the button?  Keep in mind I do not want to remove the original button, just add another "copy" of it.

3.  I would also like to add a "Continue Shopping" button in the blue highlighted area of that same page.  I was able to find some code in this thread/post, but it was never mentioned if it actually worked.  I would be happy with this button sending the shopper back to either the page they were on before clicking on the "X images in cart" button or the main gallery page.

Thank you for any help and Happy Holidays!

Keith

Stramm

1. plugins/photo_shop/include/functions.inc.php
find and replace function photoshop_format_price with the one in this post

//calculate and format total, discount, shipping
function photoshop_format_price($temp_price, $cd_counter, $error='', $template){
global $lang_photoshop, $SHOP_CONFIG;

$out =array();
$discount_calc = calculate_discount($temp_price, $cd_counter);
$shipping_calc = calculate_shipping();
$discount = number_format(($discount_calc),2);
$shipping = number_format(($shipping_calc),2);
$tot_price = number_format(($temp_price[1]+$temp_price[0]+$shipping_calc-$discount_calc),2);
$cd_price = number_format($temp_price[1],2);
$photo_price = number_format($temp_price[0],2);

if ($cd_price > 0) {
$cd_price2 = "{$lang_photoshop['on_cd']}: {$cd_counter['cd']} {$lang_photoshop['pics']} : {$lang_photoshop['USD']} $cd_price&nbsp;<br />";
} else $cd_price2 = '';
if ($photo_price > 0) {
$photo_price2 = "{$lang_photoshop['for_print']}: {$cd_counter['photo']} {$lang_photoshop['pics']} : {$lang_photoshop['USD']} $photo_price&nbsp;<br />";
} else $photo_price2 = '';

if ($tot_price > 0) {
if ($shipping > 0) {
$total_price = "{$lang_photoshop['shipping']} : {$lang_photoshop['USD']} {$shipping}&nbsp;<br>";
} else $total_price = "";
if ($discount > 0) {
$total_price .= "{$lang_photoshop['discount']} : % {$lang_photoshop['USD']} {$discount}&nbsp;";
}
$total_price .= "<hr size=\"1\" width=\"200\" align=\"right\" />&nbsp;";
$total_price .= "{$lang_photoshop['total']}: {$lang_photoshop['USD']} {$tot_price}&nbsp;";
} else $tot_price = '';

$out['html'] = <<<EOT
<tr>
<td colspan="6" align="center">
<hr size="1" />
</td>
</tr>
<tr>
<td colspan="6" align="right">
{$photo_price2}
{$cd_price2}{$error}
{$total_price}

</td>
</tr>
EOT;
$out['text'] = sprintf("%+63s\n\n", '');
if ($photo_price > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['for_print'].': '. $cd_counter['photo'].' '.$lang_photoshop['pics'].' :: '.$lang_photoshop['USD'].' '.$photo_price); }
if ($cd_price > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['on_cd'].': '. $cd_counter['cd'].' '.$lang_photoshop['pics'].' :: '.$lang_photoshop['USD'].' '.$cd_price); }
if ($shipping > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['shipping'].' :: '.$lang_photoshop['USD'].' '.$shipping); }
if ($discount > 0) { $out['text'] .= sprintf("%+63s\n", $lang_photoshop['discount'].' :: %'.$lang_photoshop['USD'].' '.$discount); }
$out['text'] .= sprintf("%+63s\n", '--------------------------');
$out['text'] .= sprintf("%+63s\n", $lang_photoshop['total'].': '.$lang_photoshop['USD'].' '.$tot_price);

return $out[$template];
}

Stramm

#2
2+3. photo_shop_cart.php
find
} elseif(isset($_POST['empty_basket'])) {
setcookie($CONFIG['cookie_name'] . '_cart', '', time() + 86400 * 30, $CONFIG['cookie_path']);
unset ($_SESSION['photoshop']['cart']);
  photoshop_refresh($_SERVER['PHP_SELF'].'?file=photo_shop/photo_shop_cart&box='.$box);
exit;
}

replace with
} elseif(isset($_POST['empty_basket'])) {
setcookie($CONFIG['cookie_name'] . '_cart', '', time() + 86400 * 30, $CONFIG['cookie_path']);
unset ($_SESSION['photoshop']['cart']);
  photoshop_refresh($_SERVER['PHP_SELF'].'?file=photo_shop/photo_shop_cart&box='.$box);
exit;
} elseif(isset($_POST['checkout'])) {
  photoshop_refresh($_SERVER['PHP_SELF'].'?file=photo_shop/photo_shop_checkout');
exit;
} elseif(isset($_POST['continue']) && isset($_POST['referer'])) {
photoshop_refresh($_POST['referer']);
exit;
}


find
<input type="submit" class="button" name="empty_basket" value="{$lang_photoshop['empty_basket']}" />

below add
<input type="submit" class="button" name="checkout" value="{$lang_photoshop['checkout']}" />


find
photoshop_create_cart_form($box);


echo <<<EOT
                <tr>
                        <td align="left" class="tablef" colspan="7">
                            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                                <tr>
                                    <td width="100%" align="center">
                                        <input type="hidden" name="box" value="{$box}" />

after add
                                        <input type="hidden" name="referer" value="{$_SERVER['HTTP_REFERER']}" />
<input type="submit" class="button" name="continue" value="{$lang_photoshop['continue']}" />


in the lang file english.php after
  'myorders' => 'My Orders',

add

  //continue button
  'continue' => 'Continue shopping',



The header is sent by the browser, some browsers allow to modify the header (and so the referer). Some software firewalls block the referer (ie Norton). So the continue button might not work as expected for some people.

PerformanceImagery

Thanks Stramm.

1. Working perfectly.

2. Has an issue.  In the fourth bit of code you posted, I think there is a cut and paste typo.  You have the value set to value="{$lang_photoshop['empty_basket']}".  I think that needs to be some thing like, value="{$lang_photoshop['checkout']}".  Im not sure if that is the correct thing to put in there though.  When I do this, the orginal top checkout button works correctly, but the new one does not.

3. Not working, see this new thread as I think it is a seperate/new issue.

Thank you for all your help.  If you have a way for me to send you funds, I'd gladly buy you a beer for all the hard work you do for everyone.


PerformanceImagery

Issues 2&3 solved on the other thread (link posted in my last post).

Stramm

perfect
I've edited the above instructions and fixed the wrong placeholder