Bitcoin Forum
December 05, 2016, 12:54:16 PM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1] 2 »  All
  Print  
Author Topic: Zen Cart Bitcoin Payment Module  (Read 7428 times)
F4C3
Jr. Member
*
Offline Offline

Activity: 31



View Profile
May 05, 2011, 01:28:01 AM
 #1

This can be found here https://github.com/jalder/Zen-Cart-Bitcoin-Payment-Module

Coin Daemon: A bitcoind Hosting Service
1480942456
Hero Member
*
Offline Offline

Posts: 1480942456

View Profile Personal Message (Offline)

Ignore
1480942456
Reply with quote  #2

1480942456
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
bitcool
Legendary
*
Offline Offline

Activity: 1441

Live and enjoy experiments


View Profile
May 05, 2011, 02:02:10 AM
 #2

this is great, got to try it out.
Bit_Happy
Legendary
*
Offline Offline

Activity: 1442


A Great Time to Start Something!


View Profile
May 07, 2011, 08:27:04 AM
 #3

Can it be used with any type of hosting, or Does this require bitcoind to be running?
Does it work with MyBitcoin SCI? Thank you.

Edit: This looks like the answer:
...enter your bitcoind rpc information.

15DYJpWJe9H1YofsNQbP9JEWWNn7XPZgbS
deadlizard
Member
**
Offline Offline

Activity: 112



View Profile
May 07, 2011, 09:32:55 AM
 #4

ERROR: module not loaded due to missing language file: Sad

btc address:1MEyKbVbmMVzVxLdLmt4Zf1SZHFgj56aqg
gpg fingerprint:DD1AB28F8043D0837C86A4CA7D6367953C6FE9DC

F4C3
Jr. Member
*
Offline Offline

Activity: 31



View Profile
May 07, 2011, 04:46:33 PM
 #5

Wow! Sorry about that deadlizard.  I had forgotten to commit the language file to git.  It is there now.  Please try again.

Coin Daemon: A bitcoind Hosting Service
OzzyMK
Newbie
*
Offline Offline

Activity: 5


View Profile
May 10, 2011, 02:06:55 AM
 #6

Hi

I can get the bitcoin module to show up in ADMIN>Modules>Payment but when I go to check out it says Payment Method : Bitcoin Payment but it's just a blank page after that? Anyone else getting this?

Thanks in advance
F4C3
Jr. Member
*
Offline Offline

Activity: 31



View Profile
May 10, 2011, 02:25:58 AM
 #7

Did you enable the module and enter your RPC credentials?  It requires a bitcoind rpc server to connect to.

Coin Daemon: A bitcoind Hosting Service
F4C3
Jr. Member
*
Offline Offline

Activity: 31



View Profile
May 10, 2011, 02:44:23 AM
 #8

Please pull a fresh copy from github.  I have added more verbose error messages for when the server cannot be reached.

Coin Daemon: A bitcoind Hosting Service
OzzyMK
Newbie
*
Offline Offline

Activity: 5


View Profile
May 10, 2011, 07:03:05 AM
 #9

Ah, will have to look into bitcoind rpc server bit lol, us damn noobs!!!

Thanks for your reply.
dudman8
Newbie
*
Offline Offline

Activity: 2


View Profile
May 14, 2011, 12:27:10 PM
 #10

Hi

I'm really excited about this, but having problems understanding how to configure the rpc info in this module. Do I have to run this locally on my own computer (which isn't running all the time), our site is hosted by someone else. Is there some more info on how to set this up etc.

Sorry for the dumb question
Thanks
Neil
F4C3
Jr. Member
*
Offline Offline

Activity: 31



View Profile
May 14, 2011, 04:29:33 PM
 #11

Hi Neil,

I foresaw that as a problem people would encounter.  I am currently building a platform for hosted bitcoind instance for end users.  This way you don't need to keep you home computer on all the time and will be able to connect to my service which will offer isolated bitcoind instances and wallets, unlike mybitcoin....  It will be a hosting service similar to a hosted website service (if that clarifies things for you).

I will be looking for beta testers very soon.  If you are interested in beta testing, PM me with your website and email and we can take it from there.

Best Regards,
face

Coin Daemon: A bitcoind Hosting Service
Clipse
Hero Member
*****
Offline Offline

Activity: 504


View Profile
May 22, 2011, 11:48:26 PM
 #12

Nice cart addon.

In its current state is there no way to just support mybitcoin wallets via their SCI implementation ?

...In the land of the stale, the man with one share is king... >> Clipse

We pay miners at 130% PPS | Signup here : Bonus PPS Pool (Please read OP to understand the current process)
Valhalla1
Jr. Member
*
Offline Offline

Activity: 52


View Profile
June 06, 2011, 07:43:43 AM
 #13

thanks for this module.  I am trying to setup a web store selling a product for bitcoins.   I have not had luck yet with the wordpress-e-commerce plugin, or the drupal/ubercart module, so now I turned to this ZenCart module.

I have setup a testbed and installed ZenCart and this Bitcoin Payment module, and have a few questions.

Does it automatically check for payment? What happens if someone orders and never pays?  From my testing, it appears that someone can just order over and over again and never pay and drain your store of apparent in-stock inventory (denial of service attack)

Also, it always gives the same bitcoin address for payment.  I assume this is because it is connecting to my bitcoind and I only have 1 address.  Is there any way to make it generate a new payment address for each sale?  I am not even sure why this is done, but this is how the wordpress and drupal modules work I think.  Is this for anonymity and/or security concerns?

Also in the installation text, it says there should be a link under Admin-> Extras to 'bitcoin.php' to view  bitcoin transactions.  This link wasn't present for me, but I could manually type in /[myadmindir]/bitcoin.php to access it.  Minor gripe.

Finally, is there a way to make the prices show in ฿, Ƀ,  Ⓑ, β, ⓑ, or BTC?    As it is setup by default, I have bitcoin as the only accepted payment form but the prices are all listed by ZenCart in $'s.   So my product costs BTC 3 but it looks like it costs $3

Thanks for any help, hope to be serving the bitcoin community with more products to spend bitcoins on soon.
F4C3
Jr. Member
*
Offline Offline

Activity: 31



View Profile
June 06, 2011, 03:47:51 PM
 #14

Hi Valhalla1,

Regarding the addresses, from this line you can see that it generates a new account and address for each transaction:
$address = $bitcoin->getaccountaddress($order->customer['email_address'].'-'.session_id());

So the customers email address- session_id are the unique identifiers for the account.  By this method it creates a unique payment address for each session, as a typical user would make one checkout per session.  You are experiencing the same payment address over and over as you are testing with the same session.  This can be modified in a future release if you would like.

Regarding the link, do you have this file uploaded? / includes / boxes / extra_boxes / bitcoin_extras_dhtml.php

If so, it should automagically create the link, let me know otherwise.

The currency aspect is kind of decoupled from the payment gateway.  So this question may be a bit outside my area of expertise.  I will look further into it and let you know of any updates.

As for the repeated ordering, it leaves the payment state as Pending, I think there may be a setting in zencart to not deduct from quantity dependant on the order status.  Currently the module requires manual confirmation of the funds being deposited into the account.  There are some helper links at the admin/bitcoin.php table.

Coin Daemon: A bitcoind Hosting Service
Valhalla1
Jr. Member
*
Offline Offline

Activity: 52


View Profile
June 06, 2011, 06:02:08 PM
 #15

thanks for the reply.  Indeed I was testing all from 1 session and 1 fake customer/email address, thats why I was only getting bitcoin payment 1 address, thanks for that information. Obviously I didn't test too thoroughly, lol. Glad to know it does indeed generate new addresses.  I'll check into fixing my zencart settings so it doesn't nuke my inventory numbers on pending payments.

also I had the bitcoin_extras_dhtml.php in /[zencart]/boxes/extra_boxes  but I just copied it to /[zencart]/[admindir]/boxes/extra_boxes and now I have the bitcoin.php link, sweet.


I see this site http://www.bitcoinmart.com    uses Zen Cart and bitcoin and lists prices in ' ฿' so I now see it is possible.  I'm guessing they modified some core zencart template file, I just don't know which one.. I'm totally new to zencart.  Maybe I'll email them and see if they will enlighten me.


One more question - how possible would it be to have prices automatically change with the bitcoin exchange rate?  For now as long as the price doesn't move too violently I can just update the price manually daily or whatever, especially since I will be started with only a handful of products.  But thinking long term, it would be handy to enter my price in some fiat currency like dollars and it automatically lists them in the equivalent bitcoin price, fluctuating with the exchange rate.
F4C3
Jr. Member
*
Offline Offline

Activity: 31



View Profile
June 06, 2011, 06:38:52 PM
 #16

automatic currency updates is something that has been discussed for a while.  It really wouldnt be too difficult to do, I could write up a cron job that will run every X minutes/hours to average the mtgox USD rate and update the zencart rate.

I have to finish a few other projects I've been working on in my free time before I can write that script though.

Coin Daemon: A bitcoind Hosting Service
Valhalla1
Jr. Member
*
Offline Offline

Activity: 52


View Profile
June 06, 2011, 07:17:57 PM
 #17

I posted on zen cart forum about how to not reduce the inventory when payment status is pending, and they are indicating its not possible, but I could try and code it myself.  Unfortunately I'm not up to that skill level yet, but perhaps some day. 

I'll just have to stay on top of things and monitor payment status and BTC/USD exchange rates and keep everything up to date, at least until I build up some bitcoins and contribute some kind of bounty/donation for a skilled programmer to do it. 

thanks again
Valhalla1
Jr. Member
*
Offline Offline

Activity: 52


View Profile
June 08, 2011, 09:05:12 AM
 #18

automatic currency updates is something that has been discussed for a while.  It really wouldnt be too difficult to do, I could write up a cron job that will run every X minutes/hours to average the mtgox USD rate and update the zencart rate.

I have to finish a few other projects I've been working on in my free time before I can write that script though.


playing with it more and learning as I go, I was able to manually add Bitcoin as a currency in the zen cart 'currencies' table, and set it as the default currency, and added its symbol as 'Ƀ'

the exchange rate is set the the database as well.  I could just write a script which gets the mtgox exchange rate every 1-5 mins and run a sql command to update the exchange rate.  Is this right?
Valhalla1
Jr. Member
*
Offline Offline

Activity: 52


View Profile
June 09, 2011, 07:17:07 AM
 #19

I really want to get a semi-automated exchange rate setup for my zen cart store, especially with this recent bitcoin price volatility I'd like to run it at least once an hour.

I found a Zen Cart currency updater module here.

Run by cron, it fetches this XML file from the European Central Bank to get the current exchange rates, and repopulates the zen cart mysql database with the latest exchange rates.

Problem is of course, bitcoin exchange rates aren't listed on by the Euro Central Bank.  

I see mtgox has this feed - https://mtgox.com/code/data/ticker.php

here's the code of the zen cart currency updater module.  now if I can figure out how to modify it to uses the mtgox feed...

Code:
#!/usr/bin/php
<?php

/**
 * Automatic Currency Update v4.0
 * Originally by Richard Fink (masterblaster)  based on Zen Cart manual currency update
 * updated by Kuroi to include Zen Cart's currency uplift ratio
 * further updated by Kuroi to use European Central Bank reference rates  (adapted from ECB-supplied code)
 *
 * Rework for PHP 5.3 compatibility (ereg and mysql_db_query functions deprecated in PHP 5.3.0)
 * switched to using SimpleXML and mysqli instead.
 * JeRo www.jero.co.nz 18/06/2010
 *
 * license: GNU Public License V2.0
 *
 **/

# Set this to the physical path of your installation.
# Make sure to include the trailing "/"
define('PATH_TO_STORE_ROOT','');

// Get Zen Cart configuration data
require_once(PATH_TO_STORE_ROOT 'includes/configure.php');
require_once(
PATH_TO_STORE_ROOT 'includes/database_tables.php');

if (! 
$mysqli=new mysqli(DB_SERVERDB_SERVER_USERNAMEDB_SERVER_PASSWORDDB_DATABASE))
    die(
"Can't connect to DB");

# Get default currency.
$row=$mysqli->query("select configuration_value from " TABLE_CONFIGURATION .
                    
" WHERE configuration_key='DEFAULT_CURRENCY' LIMIT 1 ")->fetch_row();
define('DEFAULT_CURRENCY'$row[0]);

#Get currency conversion ratio.
$row=$mysqli->query("select configuration_value from " TABLE_CONFIGURATION .
                    
" WHERE configuration_key='CURRENCY_UPLIFT_RATIO' LIMIT 1 ")->fetch_row();
define('CURRENCY_UPLIFT_RATIO'$row[0]);

# Create new SimpleXML element from the Euro zone file
# If your PHP configuration does not have allow_url_fopen, you may need to
# write a script to pick it up using wget:
# wget -O eurofxref-daily.xml www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml
# and then uncomment/comment these next two lines:
#$xml = new SimpleXMLElement(file_get_contents("eurofxref-daily.xml"));
$xml= new SimpleXMLElement(file_get_contents("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"));

# extract your preferred currency's exchange rate.
$nzd $xml->xpath("//*[@currency='".DEFAULT_CURRENCY."']");
$base = (float)$nzd[0]['rate'];

# If our default currency is the Euro, it won't be in the XML,
# so set the base exchange rate to 1
if (DEFAULT_CURRENCY == 'EUR')
    
$base=(float)1;

# Get array of currency data from the XML file.
$currencies=$xml->xpath("//*[@currency]");

# Use a prepared query for slightly faster execution.
# Note this is an update, not and insert or replace.
# This statement assumes that your currency codes are the same
# as the international standard ones.
$stmt=$mysqli->prepare("update ".TABLE_CURRENCIES" set value=?,last_updated=now() where code=?");

# Iterate over array, pulling out currency code and rate.
# Convert into your preferred currency.
# Pump it into the database.
foreach ($currencies as $curr) {
    
$cc  $curr[0]['currency'];
    
$rr  = (float)$curr[0]['rate'] * CURRENCY_UPLIFT_RATIO;
    
$new $rr/$base;
# But don't uplift your default currency!
    
if ( $cc != DEFAULT_CURRENCY ) {
        
$stmt->bind_param("ds",$new,$cc);
        
$stmt->execute();
    }
}

# Feed is based on the Euro, which is not included in the feed,
# therefore we need to update it manually,
# unless of course our preferred currency is the Euro
$cc='EUR';
$rr=1/$base*CURRENCY_UPLIFT_RATIO;
if (
DEFAULT_CURRENCY != $cc) {
    
$stmt->bind_param("ds",$rr,$cc);
    
$stmt->execute();
}

$mysqli->close();

?>









F4C3
Jr. Member
*
Offline Offline

Activity: 31



View Profile
June 09, 2011, 02:25:38 PM
 #20

Valhalla1,

I have a script at home that pulls down mtgox ticker data and puts it into php variables.  Keep in mind that you will probably want some kind of average to be taken rather than the most current price.

I will post the snippet later today.

Kind Regards

Coin Daemon: A bitcoind Hosting Service
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!