Jump to content

Download link in fields_list


karl.wong

Recommended Posts

I'm facing a few problems here and can't seem to find any solutions for it, any help would be much appreciated:

 

1) I'm trying to add in a downloadable link into the CRUD table.

2) The show more details button does not work (nothing happens when i click on it)

3) How can I disable the clicking on each row that directs the user to the edit page?

4) I'm using PS 1.6.0.5

 

AdminUserUploads (A custom tab in back office)

<?php
class AdminUserUploads extends AdminController {

        public function __construct(){

        $this->bootstrap = true;
        $this->table = "customer_uploads";
        $this->className = "MyUploads";
        $this->lang = false;
        $this->deleted = false;

        $customer_id = (int)Tools::getValue('id_customer_uploads');

        $this->context = Context::getContext();

        $this->fields_list = array(
            'id_customer_uploads' => array(
                'title' => $this->l('ID'),
                'align' => 'center',
                'class' => 'fixed-width-xs'   
            ),
            'p_name' => array(
                'title' => $this->l('Product Name'),
                'align' => 'center',
                'class' => 'fixed-width-xs'
            ),
            'p_desc' => array(
                'title' => $this->l('Product Description'),
                'align' => 'center',
                'class' => 'fixed-width-xs'
            ),
            'p_cost' => array(
                'title' => $this->l('Production Cost'),
                'align' => 'center',
                'type' => 'price',
                'class' => 'fixed-width-xs'
            ),
            'id_customer' => array(
                'title' => $this->l('Customer ID'),
                'align' => 'center',
                'class' => 'fixed-width-xs'
            ),
            'c_name' => array(
                'title' => $this->l('Customer Name'),
                'align' => 'center',
                'class' => 'fixed-width-xs'
            ),
            'c_contact' => array(
                'title' => $this->l('Contact Number'),
                'align' => 'center',
                'class' => 'fixed-width-xs'
            ),
            'c_email' => array(
                'title' => $this->l('Email'),
                'align' => 'center',
                'class' => 'fixed-width-xs'
            ),
            'attachment' => array(
            	'title' => $this->l('Attachments'),
            	'align' => 'center',
            	'class' => 'fixed-width-xs'
            ),
            'upload_date' => array(
                'title' => $this->l('Upload Date'),
                'type' => 'date',
                'align' => 'center',
                'class' => 'fixed-width-xs'
            ),

            'active' => array(
                'title' => $this->l('Status'),
                'align' => 'center',
                'active' => 'status',
                'type' => 'bool',
                'class' => 'fixed-width-xs'
            )
        );
        
        parent::__construct();
        }

        public function renderList(){

            //$this->actions = array('edit', 'delete', 'view');
            $this->addRowAction('details');
            return parent::renderList();
		
        }

        public function rednerForm(){

        	//$this->fields_form = array()

        	return parent::renderForm();
        }

       	public function ajaxProcess() {

        $query = "SELECT * FROM customer_uploads WHERE id_customer_uploads = '$customer_id'";

        echo Tools::jsonEncode(array(

        'data' => Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query),
        'fields_display' => $this->fieldsDisplay = array(
	        'id_customer_uploads' => array('title' => $this->l('ID')),
	        'p_name' => array('title' => $this->l('Product Name')),
	        'p_desc' => array('title' => $this->l('Product Description')),
	        'upload_date' => array('title' => $this->l('Upload Date')),  
	        'active' => array('title' => $this->l('Status'))
        	)
		));

        die();
    }
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...