Welcome Guest, Not a member yet? Register   Sign In
CI and digital goods
#1

[eluser]alexaaaaaaaaaa[/eluser]
Hi, i want to know if it's possible to create a ecommerce in CI selling digital goods.
I have created a ecomm but the problem is that i can only seel one product, i want some directions (tutorials, examples) to create a shopping cart were the user can buy multiple product at the same time (digital goods).
Regards,
Alexa
#2

[eluser]anaxamaxan[/eluser]
I haven't gone through it myself, but I did just notice this NetTuts tutorial the other day on CI and selling digital goods.
#3

[eluser]alexaaaaaaaaaa[/eluser]
[quote author="anaxamaxan" date="1286013703"]I haven't gone through it myself, but I did just notice this NetTuts tutorial the other day on CI and selling digital goods.[/quote]
yeah i've notice that but as my ecomm it's not using multiple items, what i mean is that you can't buy more than 1 product, plus is for premium members...
#4

[eluser]anaxamaxan[/eluser]
Are you using the Cart class?
It makes building a cart in CI pretty straightforward. Just be sure you're using a unique id for each item added to the cart.

For the payment processing part, there are a couple of PayPal libs around, here's one.

If this isn't helpful, how about posting some of your code?
#5

[eluser]alexaaaaaaaaaa[/eluser]
[quote author="anaxamaxan" date="1286065628"]Are you using the Cart class?
It makes building a cart in CI pretty straightforward. Just be sure you're using a unique id for each item added to the cart.

For the payment processing part, there are a couple of PayPal libs around, here's one.

If this isn't helpful, how about posting some of your code?[/quote]
hi sure i'm using the paypal lib and cart class but how to send the files "digital goods"?
after the paypal send a success message i'll email the file to his email account but...if they are more then one it's only send 1 file, the first in the cart.i'll share my code right away.
#6

[eluser]Dennis Rasmussen[/eluser]
Need to see your code before we can help.
Specially the success file/page.
#7

[eluser]alexaaaaaaaaaa[/eluser]
[quote author="Dennis Rasmussen" date="1286104986"]Need to see your code before we can help.
Specially the success file/page.[/quote]
Code:
function checkout(){
    
    $this->load->model('transaction_model');
    $this->load->model('common_model');
    
    $x = $this->cart->format_number($this->cart->total());
    
            
                    
            $condition_balance          = array('user_balance.user_id'=>$this->loggedInUser->id);
                $results                   = $this->transaction_model->getBalance($condition_balance);
                if($results->num_rows()>0)
                {
                    //get balance detail
                    $rowBalance = $results->row();
                    $this->outputData['userAvailableBalance'] = $rowBalance->amount;
                
                }
                
                        
                
                if($rowBalance->amount < $x)
                {
                
                $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', 'your not having sufficient balance to by that product please use deposit money'));
                                redirect('deposit');
                
                }
                
                else {
                
                
                $updateKey               = array('user_balance.user_id'=>$this->loggedInUser->id);    
                                    $updateData           = array();
                                    $updateData['amount'] = $rowBalance->amount  -  $x;
                                    $results               = $this->transaction_model->updateBalance($updateKey,$updateData);
                
                
                $to   = $this->loggedInUser->email;
                $file =  $this->cart_model->retrieve_products();
                
                $total = $this->cart->total_items();
                $dec = $this->cart_model->cart_content();
                $price_e = $data['products'];
                $body  = 'A product has been purchased, please check it!';
                $body .= $this->input->post('productName') . ' on '.date('m/d/Y') . ' at ' . date('g:i A') . "\n\n";
            $body .= " Details:\n";

            $body .= "$file\n\n";
            $body .= "Price:\n";
            $body .= "$x\n";
          
            $body .= "Qnt:\n\n";
            $body .= "$total";
    
            // load email lib and email results
            $this->load->library('email');
            $this->email->to($to);
            $this->email->from($this->loggedInUser->email);
            $this->email->attach($file);
            $this->email->subject('New Product has been purchased!');
            $this->email->message($body);    
            $this->email->send();                
                
                $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', 'You have successfully bought the product. Thanks!
                 '));
                                redirect('deposit');
                
                }
                        
                                                        
                        
    }




Theme © iAndrew 2016 - Forum software by © MyBB