Warehouse Products Are Accessible For All

0

We have multiple stores, and from group permissions its possible to limit a user to access a specific warehouse, but on POS dashboard any user can see all of the products from all warehouses. I think it would be more helpfull if we dont show all of the products to all users. Could you help us fix?

Thank you

Question Resolved For: Stock Manager Advance with Point of Sale Module 0 Votes 5 Answers 549 Views
Asked by Bethelehem 11 months ago

0

Answered by Mian Saleem 11 months ago

Hello,

Yes, all the data isn system level. If you assign the user a warehouse then use can only view the sales/purchase records of that warehouse only.

The products and all other data is system level and all the user can view them as per permissions.

Thank you

0

Answered by Enyinnaya Gift 11 months ago

Hi @Bethelehem
I believe what you want to achieve is to display only products available at the warehouse or location assigned to the user in the POS dashboard. This will also mean that you didn't enable overselling; hence, to achieve that, replace the following functions in the Pos_model.php path: app\models\admin\Pos_model.php.

  • products_count in line 1259 with the modified function below.
    public function products_count($category_id, $subcategory_id = null, $brand_id = null)
    {
        if ($category_id) {
            $this->db->where('category_id', $category_id);
        }
        if ($subcategory_id) {
            $this->db->where('subcategory_id', $subcategory_id);
        }
        if ($brand_id) {
            $this->db->where('brand', $brand_id);
        }
        $this->db->where('hide_pos !=', 1);
        $this->db->from('products');
        if ((!$this->Owner || !$this->Admin) && !$warehouse_id) {
            $this->db->join('warehouses_products', 'warehouses_products.product_id=products.id', 'left')
            ->where('warehouse_id', $this->session->userdata('warehouse_id'))
            ->where('warehouses_products.quantity >', 0);
        }
        return $this->db->count_all_results();
    }
  • and fetch_products in line 348 with the modified function below
    public function fetch_products($category_id, $limit, $start, $subcategory_id = null, $brand_id = null)
    {
        $this->db->limit($limit, $start);
        if ($brand_id) {
            $this->db->where('brand', $brand_id);
        } elseif ($category_id) {
            $this->db->where('category_id', $category_id);
        }
        if ($subcategory_id) {
            $this->db->where('subcategory_id', $subcategory_id);
        }
        $this->db->where('hide_pos !=', 1);
        $this->db->order_by('name', 'asc');
        if ((!$this->Owner || !$this->Admin) && !$warehouse_id) {
            $this->db->join('warehouses_products', 'warehouses_products.product_id=products.id', 'left')
            ->where('warehouse_id', $this->session->userdata('warehouse_id'))
            ->where('warehouses_products.quantity >', 0);
        }
        $query = $this->db->get('products');

        if ($query->num_rows() > 0) {
            foreach ($query->result() as $row) {
                $data[] = $row;
            }
            return $data;
        }
        return false;
    }

My name is @Enyinnaya Gift . I am an Independent software developer with in-depth knowledge of SMA system. I have done a lot of customization for many happy clients across the globe.

You can check out highlights and a demo of my latest customization by Clicking HERE - Highlights

You can also reach me via any of the following mediums for a real-time discussion on your customization request:

-Skype ID: enyinnayag
-Wechat ID: genyinnaya
-Email: [email protected]
-WhatsApp: +2348068355192

0

Answered by Bethelehem 11 months ago

Hello, Thank you for your support, The codes work fine, but products are hidden for Admin & Owner, other users can see products.

Thank you

0

Answered by Enyinnaya Gift 11 months ago

Hi @Bethelehem
Sorry for the oversight. Here are the update functions.


    public function products_count($category_id, $subcategory_id = null, $brand_id = null)
    {
        if ($category_id) {
            $this->db->where('category_id', $category_id);
        }
        if ($subcategory_id) {
            $this->db->where('subcategory_id', $subcategory_id);
        }
        if ($brand_id) {
            $this->db->where('brand', $brand_id);
        }
        $this->db->where('hide_pos !=', 1);
        $this->db->from('products');
        if ((!$this->Owner || !$this->Admin) && $this->session->userdata('warehouse_id')) {
            $this->db->join('warehouses_products', 'warehouses_products.product_id=products.id', 'left')
            ->where('warehouse_id', $this->session->userdata('warehouse_id'))
            ->where('warehouses_products.quantity >', 0);
        }
        return $this->db->count_all_results();
    }
    public function fetch_products($category_id, $limit, $start, $subcategory_id = null, $brand_id = null)
    {
        $this->db->limit($limit, $start);
        if ($brand_id) {
            $this->db->where('brand', $brand_id);
        } elseif ($category_id) {
            $this->db->where('category_id', $category_id);
        }
        if ($subcategory_id) {
            $this->db->where('subcategory_id', $subcategory_id);
        }
        $this->db->where('hide_pos !=', 1);
        $this->db->order_by('name', 'asc');
        if ((!$this->Owner || !$this->Admin) && $this->session->userdata('warehouse_id')) {
            $this->db->join('warehouses_products', 'warehouses_products.product_id=products.id', 'left')
            ->where('warehouse_id', $this->session->userdata('warehouse_id'))
            ->where('warehouses_products.quantity >', 0);
        }
        $query = $this->db->get('products');

        if ($query->num_rows() > 0) {
            foreach ($query->result() as $row) {
                $data[] = $row;
            }
            return $data;
        }
        return false;
    }

My name is @Enyinnaya Gift . I am an Independent software developer with in-depth knowledge of SMA system. I have done a lot of customization for many happy clients across the globe.

You can check out highlights and a demo of my latest customization by Clicking HERE - Highlights

You can also reach me via any of the following mediums for a real-time discussion on your customization request:

-Skype ID: enyinnayag
-Wechat ID: genyinnaya
-Email: [email protected]
-WhatsApp: +2348068355192

0

Answered by Bethelehem 11 months ago

Hello, Thanks again, seams working fine..need a minor fix tho, all products from all warehouses are visible for admin, i think better show products for selected warehouse only.

Also I checked your demo and I need this features

  • Assign Multiple Warehouse/Location to a User

Also,

  • I would like to have beep sound when adding a product
  • show product qty for specific warehouse and price for each product on pos dashboard
  • Product added list pos dashboard need product photo thumbnail

Thank you

We use Cookies

We use cookies to ensure that we give you the best experience on our website. By continuing to browse the site you are agreeing to our use of cookies.