Welcome Guest, Not a member yet? Register   Sign In
Ciqrcode generate
#1

Hi bros, how can i automatically create QrCode upon product creation.
i have managed to create the product and then to add one button which generates the QRCode for the specific id.
//Generate QRCode
public function qrgenerator($id){

$config['cacheable']    = true; //boolean, the default is true
$config['cachedir']    = ''; //string, the default is application/cache/
$config['errorlog']    = ''; //string, the default is application/logs/
$config['quality']      = true; //boolean, the default is true
$config['size']        = '1024'; //interger, the default is 1024
$config['black']        = array(224,255,255); // array, default is array(255,255,255)
$config['white']        = array(70,130,180); // array, default is array(0,0,0)
$this->ciqrcode->initialize($config);

//GenerateQR
$params['data']  = base_url().'products/'.$id;
$params['level'] = 'H';
$params['size'] = 10;
$image_name = $id.'.png';
$params['savename'] = FCPATH.'uploads/qr_image/'.$image_name;

$this->ciqrcode->generate($params);

$product = $this->product_model->get_product_by_id($id);

$data = array(
'title' => 'print_qrcode',
'product' => $product['product_id'],
'qr_image' => $image_name,
);

$this->session->set_flashdata('success', 'Generated');
redirect(base_url('product/index'));

}
Reply
#2

When you create the product save the product then get the insertId and then call your qrgenerator($id) method right after the insertId call..
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB