I have a Classic Report with a schedule for each day. There are no, one or multiple entries per day. It looks like this:
select
week_no,
apex_item.DISPLAY_AND_SAVE(p_idx => 8, p_value => plan_id) as ID,
apex_item.select_list(p_idx => 1, p_list_values => 'S1;1,S2;2,S3;3', p_attributes => 'size="3" multiple="multiple"', p_show_null => 'NO', p_show_extra => 'NO', p_item_id => plan_id || '_1', p_value => monday) as monday,
apex_item.select_list(p_idx => 2, p_list_values => 'S1;1,S2;2,S3;3', p_attributes => 'size="3" multiple="multiple"', p_show_null => 'NO', p_show_extra => 'NO', p_item_id => plan_id || '_2', p_value => tuesday) as tuesday,
apex_item.select_list(p_idx => 3, p_list_values => 'S1;1,S2;2,S3;3', p_attributes => 'size="3" multiple="multiple"', p_show_null => 'NO', p_show_extra => 'NO', p_item_id => plan_id || '_3', p_value => wednesday) as wednesday
from plan;
I can select multiple values and can save them to my table. It gets save like this "1,2". But I can't load the data rows with multiple selected values.
I can select multiple options with jQuery like this
$('#1000_1').val(["1","2"]);
but I don't know how to select the stored values from table with PL/SQL and then set the options selected with javascript.
I tried to load the data in an apex_item.text (id="1000_11" for monday etc.) and transfer the values in "After Refresh" DA to select list like that:
var sel_opt = $('#1000_11').val();
if (sel_opt == "1,2")
{
$('#1000_1').val(["1","2"]);
}
else if (sel_opt == "1,3")
{
$('#1000_1').val(["1","3"]);
}
else if (sel_opt == "2,3")
{
$('#1000_1').val(["2","3"]);
}
else if (sel_opt == "1,2,3")
{
$('#1000_1').val(["1","2","3"]);
}
It works, but maybe there's a smarter solution?
I create a sample Workspace on https://apex.oracle.com/pls/apex/f?p=4550:1:0:::::
Workspace: multi_select
Username: dev
Password: newYears3problems
I would create SELECT LIST page items for each selection menu and set their multi selection option to Yes.
then I'm guessing I'd need something like this somewhere at my page-process section
declare
array apex_application_global.vc_arr2;
begin
array := apex_util.string_to_table (:P30_SELECT_LIST_1);
apex_collection.create_or_truncate_collection ('P30_SELECT_LIST_1');
apex_collection.add_members ('P30_SELECT_LIST_1', array);
end;
to store more than one menu item at once.
then I'd add something like that to my query
and ITEM_1 in (
select c001
from apex_collections
where collection_name = 'P30_SELECT_LIST_1'
)
I probably didn't understand your question, but according to part that I get, it's straightforward sql query. no need for js.
Hello my opencart version in 1.5.6.4
I am trying to make stock status to appear in email order.
I tried this on catalog/model/checkout.order.php
$order_product_info = $this->db->query("SELECT * FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product['product_id'] . "'");
'stock' => $order_product_info->row['stock_status_id'],
and in /template/mail/order.tpl
I have this
<?php echo $product['stock']; ?>
It is almost working but it appears as an id at the email. like (product_name) 5. But not appear status name...
5 s an example of stosck_status_is
Any idea on how to make it appear as text like "Available"
after you got an stosck_status_id you should retrieve from oc_stock_status table a name where the stosck_status_id is.
$order_product_status = $this->db->query("SELECT * FROM " . DB_PREFIX . "stock_status WHERE stosck_status_id = '" . (int)$order_product_info->row['stock_status_id'] . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
'stock_name' => $order_product_status->row['name'],
Opencart doesn't show me if I don't write the full name of the model. I want to search without the full name of the model.
public_html/catalog/model/catalog/product.php
LINE 140:
$sql .= " OR LCASE(p.model) LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";
LINE: 497:
$sql .= " OR LCASE(p.model) LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";
Opencart: v.1.5.6.1
Theme: Journal v.2.1.2 (http://themeforest.net/item/journal-premium-responsive-opencart-theme/4260361)
Apache: v.2.2.26
MySQL: v.5.5.36
php: v.5.4.22
I am trying to assign the Category module to
Layout: Product
Position: Column Right (or Left it doesn't matter)
It works in all other Layouts (Home, Information, Manufacturer etc) except from Product.
I changed to the Default Opencart theme and it doesn't work either!
Something is messed up with Product Layout !??! I thought of that, so I created a CustomProduct Layout (just like the original Product Layout) and...
Catalog -> Products -> Edit-A-Product -> Design -> Layout Override: CustomProduct
guess what... It worked!
No changes to Opencart's core files are made. Everything is vQmod (theme, extensions).
I have removed my vQmods (just in case I was doing something wrong)... still it doesn't work.
In catalog/controller/common/column_right.php line 38 I added...
echo $layout_id;
The value returned is id=4 (Default Layout). Shouldn't that be id=2 (Product Layout)?
Also, the value of the key "category_module" from table oc_setting...
a:1:{i:0;a:4:{s:9:"layout_id";s:1:"2";s:8:"position";s:12:"column_right";s:6:"status";s:1:"1";s:10:"sort_order";s:1:"1";}}
I thought it was something simple and I just couldn't see it. Now I have 2 days trying to figure out what has happened!
Any suggestions ?!
Because I had downloaded Opencart v.1.5.6.1 before its public release, I didn't had the correct file for catalog/model/catalog/product.php
I had this...
public function getProductLayoutId($product_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_layout WHERE product_id = '" . (int)$product_id . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
if ($query->num_rows) {
return $query->row['layout_id'];
} else {
return $this->config->get('config_layout_id');
}
}
instead of this...
public function getProductLayoutId($product_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_layout WHERE product_id = '" . (int)$product_id . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
if ($query->num_rows) {
return $query->row['layout_id'];
} else {
return false;
}
}
All credits go to user http://www.opencart-hellas.gr/memberlist.php?mode=viewprofile&u=2
Read all here http://www.opencart-hellas.gr/viewtopic.php?f=8&t=47 (it is in Greek).
I have searched for hours but could not find an answer to this, or a module to help.
We are building a store and our client needs the ability to navigate the store by manufacturer. Is there any way that the manufacturer page can list the categories and subcategories.
There seems two ways to do it.
Add brands while adding categories in admin section.
Get all categories inside the brands by join operation while viewing the manufacturer.
Are there any modules available to link up categories with manufacturers so that I can display categories inside the manufacturer page.
Or the only way is to query all the products inside the manufacturer and get the categories out of it... I guess it is not a good solution.
So any suggestions would be a great help.
Thanks.
I figured a way to find the categories that belongs to a manufacturer. The second options seems better.
Here is the function that I added to catalog/model/catalog/manufacturer.php
public function getManufacturerCategories($manufacturer_id) {
$query = $this->db->query("
SELECT
DISTINCT c.category_id,cd.name
FROM
". DB_PREFIX . "manufacturer m
LEFT JOIN ". DB_PREFIX. "product p ON (m.manufacturer_id = p.manufacturer_id)
LEFT JOIN ". DB_PREFIX. "product_to_category p2c ON (p2c.product_id = p.product_id)
LEFT JOIN ". DB_PREFIX. "category c ON (c.category_id = p2c.category_id)
LEFT JOIN ". DB_PREFIX. "category_description cd ON (cd.category_id = p2c.category_id)
WHERE
p.status = 1
AND m.manufacturer_id = '".(int)$manufacturer_id."'
AND c.status= 1
");
return $query->rows;
}
Here is the output array
stdClass Object (
[row] => Array
(
[category_id] => 20
[name] => Desktops
)
[rows] => Array
(
[0] => Array
(
[category_id] => 20
[name] => Desktops
)
[1] => Array
(
[category_id] => 24
[name] => Phones & PDAs
)
)
[num_rows] => 2 )