Help with PHP Help with PHP
 

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

Help with PHP

Started by fareforce, June 22, 2005, 08:12:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fareforce

I am apoligizing in advance if this is in the wrong thread, but I'm not quite sure where to go with this one. I am creating a php script that I can call in my theme.php file. This is basically what I hope it will do.

From edit description page on each picture I can enter in a base value for that picture (ie: $25.00) (this is a modified shop hack here).

Then in my admin>config page I need to enter in some price values for different price options
(ie:
  if 5"x7" add $0.00
  if 8"x10" add $20.00
  and so on...)

It will gather all that info, generate a total price, then send it to my shopping cart. The problem I am having is how do I get the price values to show up on the config page so I can just change them through my website? It is probablly something really simple that I am overlooking, but hey.. My brain is fried from working on this thing.

fareforce
http://www.alaskastudio.com
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

havoc615

From what I see you want the thing on that page. What you probably want to do to keep things simple. On view picture page, where you have those two select menus do something like:<SELECT name=size>
<option value=priceadd>Size
</select>


but I am not sure how you have other stuff set-up to work right now, and does it have to be available in the admin cfg? If you don't plan to vhange the price often. Maybe think about doing something like above...let us know.

fareforce

#2
There are actually a lot more options that I am going to use other then just the one that I gave as an example, but all other will work in the same fasion.  This is also going to feed off of mysql much like to paypal shop hack. I would prefer to be able to access it from the admin>config page for three reasons:
1.) Later on I am going to convert the script to allow each user to post thier own pictures, and set thier own prices.
2.) My cost on getting the print made are constantly changing.
3.) I might not be the one who needs to change the price, and the person doing it might not know html/php.

fareforce
http://www.alaskastudio.com
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

havoc615

Ok, have you considered using one of the user1 fields to set the price for each photo? We can get the price thing into the admin page, lemmie know where you want it and specifically how many/what options you want. i.e. do you want added price for each size?

fareforce

#4
Of course by looking below you can see how it gets confusing fast.. Hence why it will be it's own php file. Because these options will change for each size, then different types of frames, etc. here is a base of what i will need. If I can figure out how to add on field to the admin<config file I can add more as needed. The prices are going to be kept in it's own mysql table to make it a little easier on me.. This is basically going to be a complete e-comerce mod when I am done with it..

I would estimate it would be as follows: ( i might need to add more later, but this is it for now. This is also just the options for one size, each size will have the same option, but with different prices.)

Option_1 = Size
1. 4'x6"
2. 5"x7"
3. 8"x10"
4. 24"x36"

Option_2 = Frame
1. Wood frame
2. Metal Frame
3. No Frame

if Option_2 = (1.Wood frame)
then select color:
1. Black
2. Light Maple
3. Medium Maple
4. Dark Maple

else if Option_2 = (2. Metal Frame)
then select color:
1. Black
2. Gold
3. Silver

Option_3 = Shipping
if option_2 = (metal frame or wood frame)
then select shipping
1. FedEx 2day ($45.00)
2. FedEx Ground ($25.00)

else select shipping
1. FedEx 2day ($35.00)
2. FedEx Ground ($15.00)


fareforce
http://www.alaskastudio.com
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

fareforce

I think I am trying to make this to difficult.. I think what I will do is add an array into displayimage.php and link it to the fields that my shop hack have already created in editpic.php. I should be able to add a few extra fields in there to put in the price info, and I will just keep everything hidden. I will play with it on my test site and we will see what happens.. It should work.. I think..  If it does I will be able to set different prices for all options on each picture. (that might be kinda cool) 

Let me know if you can think of a different way..
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

havoc615

WAit wait I have a good idea...what if we made an entirely seperate page. And simply have a button that says buy this photo on the photo pages. Then passes the picnum to the buy page. Then that page can be more openly designed and handle all the other stuff?

fareforce

Hey, I like that idea...  That would keep things running smother and faster, and would probablly be a heck of a lot easier to pass the final stuff to the shopping cart as well.

I will have to get started on that..

Time to dig out the coding book again..  lol
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

havoc615

I would be more then happy to help if you have any questions, feel free to contact me on AIM (Preferably), or MSN/Yahoo.

FOr the view page, I suggest making what you have now into something like
<form method=post action="your handler.php">
<input type=Submit name=picture['$picturenum'] value="Buy This Picture>
</form>

then all you have to do is like a foreach run and you can extract the picture number and do stuff with it, (If you really wanted to get into it, you could add checkboxes to thumbnails.php (For example to purchase items on a page, from a search, or from user favorites, and have a link to buy them now at the bottom, using same method. THis same process would support multi-pictures)