Advanced search  

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]

Pages: 1 ... 16 17 18 19 [20] 21 22 23 24 ... 30   Go Down

Author Topic: Shopping cart  (Read 652991 times)

0 Members and 1 Guest are viewing this topic.

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #380 on: October 20, 2007, 09:29:31 pm »

remove unnecessary wording to make it smaller... eg there's the white heading 'Add image to shopping basket: ' on white background before the dropdown... remove it (lang/english.php) or make it smaller an you should be good

krp

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Shopping cart
« Reply #381 on: October 22, 2007, 11:22:51 pm »

Thank you for support Stramm. Everything working great. Thank you again :) :) :) ;D
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #382 on: November 01, 2007, 10:15:09 am »

Hi Stramm

It's nearly Christmas ... and due to your excellent mod I am managing to make some money for a change. I owe you a Christmas present all the way from South Africa, so please pm me with some contact details.

Anyway (this is not bribing) I do have a question: I am busy with a website for temp tattoos.  There are 4 Types, about 6 sizes, and 200 + designs per tattoo ... I need to sell them (per size) for a certain amount at certain prices.  How do I do this when adding the information to the shop config ?
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #383 on: November 02, 2007, 10:33:29 am »

Easiest way to do that would be to add for each type all sizes.
-type 1 4x6
-type 1 5x7
-type 1 6x8
-type 1 7x9
-type 2 4x6
-type 2 5x7
-type 2 6x8
-type 2 7x9
.... that for all four types
if you look for let's say two dropdowns, one with type, the other containing the size... then this is not possible without changing a good bunch of code in nearly all files. Also db modifications would be necessary. A task that can't be done in a few minutes.

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #384 on: November 07, 2007, 03:17:54 pm »

Hi Stramm

Thanx, yea, I figured it would be the only way, it will take me a while, but I guess ones it's done, it's done.

The only thing I don't like is that as soon as you add an item (or all items), it automatically adds it to all albums ... in what code can I change to NOT add it, but rather let me enable the albums for the prices as I wish ...

Thanx yet again for all your help.
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #385 on: November 07, 2007, 03:23:44 pm »

to exclude certain albums from the shop functionality is a shop admin setting as well as letting certain albums override the global prices.

If you want to not exclude but rather enable the shop for certain albums you'll have to change code as you said. That code you can find in codebase.php function add_item (I think it was).

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #386 on: November 12, 2007, 08:33:08 pm »

Stramm

If I want to enable discount for a user group called Agents ... how do I fix the code to ONLY give them discount based on number of pics they order ? This will be in functions.php.

Something like:

function calculate_discount($temp_price, $cd_counter){

   $discount = '';
   //variables that can be used
   //$cd_counter['photo']  number of pics for print
   //$cd_counter['cd']      number of pics on CD
   //$temp_price[1]      price for the CD
   $temp_price[0];      //price for the pics

   //just to demonstrate how to calculate a discount
   //10% on print images if user orders more than 10 pics
   
   if ((!USERGROUP) >= AGENTS)) {
   if($cd_counter['photo'] >= 0);
   
      $discount = 0.1 * $temp_price[0];
   }
   

   /*
   //or another example... 10% if the order volume is > 100USD
   if($temp_price[0] >= 100) {
      $discount = 0.1 * $temp_price[0];
   }
   */
   return $discount;
}
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #387 on: November 12, 2007, 09:32:46 pm »

Looks somehow made up with some syntax errors. At least a constant USERGROUP isn't defined
You could try that instead

Code: [Select]
if (USER_GROUP == 'AGENTS') {
$discount = 0.1 * $temp_price[0];
}

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #388 on: November 12, 2007, 09:53:51 pm »

Hi Stramm

Thanx for the help ... I created two groups with different discounts .... problem is that altough the calculation is correct, the total amount seems to be wrongly calculated ...

Products: 1 Design(s) ::   R  35,000.00
Agent Discount :: % :: R 5,250.00
Total: R  34,995.00

Also the percentage discount before the % sign do not show ....

Can you help please ?

Thanx in advance

Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #389 on: November 12, 2007, 10:03:11 pm »

this is how it should look
Quote
For print: 7 pics :: 14.00USD
Shipping :: 4.00USD
Discount :: % 1.40USD 
Total: 16.60USD

And as you can see it works pretty good.  I do not know what you've modified so I can not give you much advice.

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #390 on: November 12, 2007, 10:11:04 pm »

I don't charge shipping ... can that be the problem ?
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #391 on: November 12, 2007, 10:18:22 pm »

no

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #392 on: November 12, 2007, 10:19:12 pm »

Stramm

The % gives the discount amount and not the percentage and the discount amount (e.g.  15% :: R 25.00 )

Is there a way to indicate the discount percentage ?
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #393 on: November 12, 2007, 10:26:16 pm »

I digged around and have seen that there indeed is a problem. Will look into this tomorrow.

The percentage as you want to display it isn't known by the system. You can define the discount in the function you just modified and here you can do whatever math you like and not just using percentages (% is in my country the sign for difference, if you do not like it you can renove it - has been asked and answered before)

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #394 on: November 13, 2007, 11:15:48 am »

Here's the fix for your problem. It occurs when the numbers are >= 1000. The problem was the formatted output of the numbers (eg. 12,000.00 instead of 12000.00).

In plugins/pgoto_shop/include/functions.inc.php find
Code: [Select]
$discount = number_format(calculate_discount($temp_price, $cd_counter),2);
$shipping = number_format(calculate_shipping(),2);
$tot_price = number_format(($temp_price[1]+$temp_price[0]+$shipping-$discount),2);
$cd_price = number_format($temp_price[1],2);
$photo_price = number_format($temp_price[0],2);
and replace with
Code: [Select]
$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);

edit: added number format for discount and shipping as noted by JohannM 2 posts below
« Last Edit: November 13, 2007, 05:58:10 pm by Stramm »
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #395 on: November 13, 2007, 04:36:51 pm »

Hi Stramm

Seems to me the calculations is correct now, but the discount amount is not with decimal places:

Products: 2 Design(s) ::   R  57,500.00
Discount :: % :: R  14,375
Total: R  43,125.00

Is there a way to have fixed digits (e.g. 9 number format) ?
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #396 on: November 13, 2007, 04:40:27 pm »

should be:

    $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);

That is fixed now ...

Just wonder about fixed length of digits ...
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 252
Re: Shopping cart
« Reply #398 on: November 14, 2007, 03:17:10 pm »

Stramm

Just a question ... if you add an item to the shopping basket, for a brief moment the page refresh with only the footer (Powered by Coppermine) etc.

Is there a way to add a line there for e.g. "Adding product to basket" ? And where in what file (line) can I add this ?

Check out my new site:  http://www.temp-tattoos.co.za/agents/

I'm still doing some changes ...
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Shopping cart
« Reply #399 on: November 14, 2007, 03:41:18 pm »

yah, I always wanted to add this... started to code it but never finished. Somehow I had implemented it but, hmmm... I didn't like it. The remainings you'll come across when I show you what to do.

plugins/photo_shop/codebase.php find
Code: [Select]
photoshop_refresh($referer);replace with
Code: [Select]
photoshop_refresh($referer, $lang_photoshop['added']);

plugins/photo_shop/include/functions.inc.php
replace the already existing function photoshop_refresh with this new one
Code: [Select]
function photoshop_refresh($redirect, $txt='') {
global $lang_info;

            pageheader($lang_info, "<META http-equiv=\"refresh\" content=\"0;url={$redirect}\">");
            if($txt !='') {
msg_box ($txt, $txt);
}
            pagefooter();
            ob_end_flush();
exit;
}
Pages: 1 ... 16 17 18 19 [20] 21 22 23 24 ... 30   Go Up
 

Page created in 0.023 seconds with 19 queries.