SentiJB Posted April 29, 2021 Share Posted April 29, 2021 so when you have : yourstore.com/index.php?a=getcontent&content_id=the_id_for_the_content 1) how can you get the_id_for_the_content from the url. is that something like : $the_id = $_GET['the_id_for_the_content']; 2) how can you set that it has to search for customer id AND the_id_for_the_content $where = array('customer_id' => $GLOBALS['user']->get('customer_id')); if (($get_the_content = $GLOBALS['db']->select('CubeCart_database_name', false, $where, array('id' => 'DESC'), $per_page, $page, false)) !== false) { can't seem to get it to work Link to comment Share on other sites More sharing options...
bsmither Posted April 29, 2021 Share Posted April 29, 2021 index.php?_a=contentType&content_id=theItemID_for_the_content_type index.php?_a=product&product_id=67 We recommend to use a leading underscore for the key name of the contentType. CubeCart will first try to build a friendly URL - but I won't get into that now. 1) Correct. The $_GET array will have the key ['product_id'] holding the value "67". 2) You can use $GLOBALS['user']->get() to get the logged-in customer ID value from the session. What data needs to be supplied in the query, of course, depends which table you are querying. But the format is correct. (The CubeCart_order_summary table has details about the customer, including the 'customer_id', but not the 'product_id' of any of the items in the order. The data about the order's items is in the CubeCart_order_inventory table, but no data about the customer. The one thing that joins these two tables is CubeCart's standard cart_order_id code.) Also, records returned are in an indexed array. That means $get_the_content is an array where the keys are numbered starting at [0], and the content of each array element is itself an associative array, such as ['customer_id'] holding the value "67". All together: $get_the_content[0]['customer_id'] holds "67". Link to comment Share on other sites More sharing options...
SentiJB Posted April 30, 2021 Author Share Posted April 30, 2021 $get_the_content = $_GET['scr_id']; $where = $get_the_content[0]['customer_id']; if (($weergaven = $GLOBALS['db']->select('CubeCart_content', false, $where, array('id' => 'DESC'), false)) !== false) { foreach ($weergaven as $weergeven) { if i try this it doesn't print result. so the table content contains : row customer_id and get_the_content with the scr code provided in url and customer id : there will be 1 result Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.