Bitcoin Forum
May 07, 2024, 11:46:28 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Zen Cart Bitcoin Payment Module  (Read 8050 times)
Valhalla1
Newbie
*
Offline Offline

Activity: 51
Merit: 0


View Profile
June 09, 2011, 10:26:04 PM
 #21

I just realized that as I have it setup, with products in zen cart priced in bitcoin and bitcoin shown as the prices on the storefront, I wouldn't be able to set a static price in, say, US dollars - I'd still have to constantly adjust the prices in bitcoin with the exchange rate.

is it possible to set a fixed price for zen cart products in one currency, but not actually use that currency as the default?
1715082388
Hero Member
*
Offline Offline

Posts: 1715082388

View Profile Personal Message (Offline)

Ignore
1715082388
Reply with quote  #2

1715082388
Report to moderator
1715082388
Hero Member
*
Offline Offline

Posts: 1715082388

View Profile Personal Message (Offline)

Ignore
1715082388
Reply with quote  #2

1715082388
Report to moderator
1715082388
Hero Member
*
Offline Offline

Posts: 1715082388

View Profile Personal Message (Offline)

Ignore
1715082388
Reply with quote  #2

1715082388
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715082388
Hero Member
*
Offline Offline

Posts: 1715082388

View Profile Personal Message (Offline)

Ignore
1715082388
Reply with quote  #2

1715082388
Report to moderator
1715082388
Hero Member
*
Offline Offline

Posts: 1715082388

View Profile Personal Message (Offline)

Ignore
1715082388
Reply with quote  #2

1715082388
Report to moderator
1715082388
Hero Member
*
Offline Offline

Posts: 1715082388

View Profile Personal Message (Offline)

Ignore
1715082388
Reply with quote  #2

1715082388
Report to moderator
F4C3 (OP)
Newbie
*
Offline Offline

Activity: 31
Merit: 0



View Profile
June 09, 2011, 10:52:50 PM
 #22

As I understand it, zencart requires a fixed point of reference and then you put in the currency conversion for all other currencies.  There may be a way to hack around this, but what I think you are suggesting is in zencart when you create or edit a product, you want a list of currencies and how much to charge for the item for each currency regardless of conversion equality?

Otherwise, I think you may just be mixed up, if BTC is set as the default, and you set a product at that BTC value, then you would be adjusting the USD equivalent with the rate update script, and vice versa for USD is the default (frame of reference).

Anywho, as promised, here is a short little script to take the mtgox ticker and break it down into an array.  I've included a curl function to make it even easier for you.

Code:
<?php 


$data 
curl_grab_page('https://mtgox.com/code/data/ticker.php');

$data str_replace('{"ticker":','',$data);
$data str_replace('}}','}',$data);

$mtgox json_decode($data,true);

var_dump($mtgox);  //This is your mtgox data, use this to perform some math and update the currency table

function 
curl_grab_page($url,$ref_url,$data,$login,$proxy,$proxystatus){
    if(
$login == 'true') {
        
$fp fopen("cookie.txt""w");
        
fclose($fp);
    }
    
$ch curl_init();
    
curl_setopt($chCURLOPT_COOKIEJAR"cookie.txt");
    
curl_setopt($chCURLOPT_COOKIEFILE"cookie.txt");
    
curl_setopt($chCURLOPT_USERAGENT"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
    
curl_setopt($chCURLOPT_TIMEOUT40);
    
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
    if (
$proxystatus == 'true') {
        
curl_setopt($chCURLOPT_HTTPPROXYTUNNELTRUE);
        
curl_setopt($chCURLOPT_PROXY$proxy);
    }
    
curl_setopt($chCURLOPT_SSL_VERIFYHOST0);
    
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);

    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt($chCURLOPT_REFERER$ref_url);

    
curl_setopt($chCURLOPT_HEADERFALSE);
    
curl_setopt($chCURLOPT_USERAGENT$_SERVER['HTTP_USER_AGENT']);
    
curl_setopt($chCURLOPT_FOLLOWLOCATIONTRUE);
    
curl_setopt($chCURLOPT_POSTTRUE);
    
curl_setopt($chCURLOPT_POSTFIELDS$data);
    
ob_start();
    
$output curl_exec ($ch);
    
ob_end_clean();
    
curl_close ($ch);
    unset(
$ch);
    return  
$output;// execute the curl command    
}



edit: realized i left a header() in there.  removed.
Valhalla1
Newbie
*
Offline Offline

Activity: 51
Merit: 0


View Profile
June 09, 2011, 11:00:40 PM
Last edit: August 24, 2011, 06:44:37 AM by Valhalla1
 #23

thanks for the code!   I think what I could do is use this to get the exchange rate, and then just divide it by my static USD price, and update the prices in bitcoin terms via mysql
F4C3 (OP)
Newbie
*
Offline Offline

Activity: 31
Merit: 0



View Profile
June 10, 2011, 12:27:54 AM
 #24

Yo
I'ma let you finish...
http://www.polyvore.com/cgi/img-thing?.out=jpg&size=l&tid=11793371

but what I would consider doing is setting USD as default. Pricing things in terms of USD, updating just the BTC currency rate table at cron.  Then in your template header, set the $_SESSION['currency'] to bitcoin so it is the default.  This way you don't have to continually modify your script every time you add a new product.
Valhalla1
Newbie
*
Offline Offline

Activity: 51
Merit: 0


View Profile
June 10, 2011, 01:57:25 AM
 #25

Yo
I'ma let you finish...
http://www.polyvore.com/cgi/img-thing?.out=jpg&size=l&tid=11793371

but what I would consider doing is setting USD as default. Pricing things in terms of USD, updating just the BTC currency rate table at cron.  Then in your template header, set the $_SESSION['currency'] to bitcoin so it is the default.  This way you don't have to continually modify your script every time you add a new product.


http://farm5.static.flickr.com/4133/4981138976_b541eeca56.jpg


nice, thanks again.  soon as I get some bitcoin I owe you a tip
Valhalla1
Newbie
*
Offline Offline

Activity: 51
Merit: 0


View Profile
July 03, 2011, 04:52:55 AM
 #26

Hey,
I haven't forgotten about my donation pledge, I'm just waiting for some customers to spend bitcoin in my store.

I do have a couple of comments on issues that have popped up for me with the zen cart bitcoin module -


lets say the BTC/USD exchange rate today was $17, and I have an item in my store that costs $17.  I set the price in the zen cart backend in USD and the default currency to USD, but then in the template files I switch that to BTC as you have suggested so my prices  show up as BTC on the store. 

Now lets say someone orders that item, it will correctly tell them the price is 1 BTC and give the payment address.  But when I go to the zen cart admin area,  Extra->Bitcoin Payment Center it shows
Order 1 |  Due 17 BTC | Received 1 BTC

in other words, it puts the USD price in as what is Due, and even after they paid in full (in BTC) it shows Pending because the module thinks they haven't paid in full due to being confused about the currency.



Secondly, it would be neat if it automatically cancelled orders after X number of hours with no payment.  I have been getting people who have never heard of bitcoins and/or don't have any, but go through the whole checkout process and then just never pay.  I guess they just want to see what a bitcoin checkout looks like, and had no intentions of paying in the first place.  Or, they think I'm listing a $17 item for $1 (ignoring the bitcoin symbol listed next to the price I guess) so they think they are getting some amazing deal and then when they go to check out and there is no place to put a credit card or paypal info (just lists a bitcoin address) they are like 'WTF is a Bitcoin?' and leave and never return.   

So I should try and mod the zen cart files so it gives some kind of warning like 'don't checkout if you don't already have bitcoins and are ready to spend them', but it would also be cool if the system automatically canceled orders after say 24 hours w/o payment.
Valhalla1
Newbie
*
Offline Offline

Activity: 51
Merit: 0


View Profile
July 24, 2011, 08:01:20 AM
Last edit: July 24, 2011, 11:14:18 AM by Valhalla1
 #27

small donation sent, thanks for your contribution to the bitcoin community.

are there any problems with multiple zen cart installations sharing the same bitcoind?
It seems to work at first glance, both instances show all transactions from both sites in the Bitcoin Payment area, but  orders only get highlighted/linked in the correct respective site it was ordered from so that's good.
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!