- Posts: 5
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Show K2 extra field data in external component like K2Store
Show K2 extra field data in external component like K2Store
- Eduard Dimitrov
- Topic Author
- Offline
- New Member
Less
More
7 years 5 months ago #162523
by Eduard Dimitrov
Show K2 extra field data in external component like K2Store was created by Eduard Dimitrov
Hello, i´ve searched the forum, but couldnt find a solution for my problem.
Is it possible to show K2 extra field data in external component like K2Store? Standart foreach used in category_item.php and item.php doesn't work:
Is it possible to show K2 extra field data in external component like K2Store? Standart foreach used in category_item.php and item.php doesn't work:
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 5 months ago #162524
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Show K2 extra field data in external component like K2Store
Hello Eduard,
K2 Store works on top of K2, so extrafields can be displayed the same way as regular K2.
K2 Store works on top of K2, so extrafields can be displayed the same way as regular K2.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Eduard Dimitrov
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
7 years 5 months ago - 7 years 5 months ago #162526
by Eduard Dimitrov
Replied by Eduard Dimitrov on topic Show K2 extra field data in external component like K2Store
Krikor, thanks, but is not workig for specific K2Store pages (pages are outside K2) - there is no fields data in foreach.
var_dump($item) show me this:
var_dump($item) show me this:
object(TableOrderItems)#489 (30) {
["_tbl":protected]=>
string(21) "#__k2store_orderitems"
["_tbl_key":protected]=>
string(12) "orderitem_id"
["_tbl_keys":protected]=>
array(1) {
[0]=>
string(12) "orderitem_id"
}
["_db":protected]=>
object(JDatabaseDriverMysqli)#15 (23) {
["name"]=>
string(6) "mysqli"
["serverType"]=>
string(5) "mysql"
["connection":protected]=>
object(mysqli)#16 (19) {
["affected_rows"]=>
int(1)
["client_info"]=>
string(79) "mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $"
["client_version"]=>
int(50012)
["connect_errno"]=>
int(0)
["connect_error"]=>
NULL
["errno"]=>
int(0)
["error"]=>
string(0) ""
["error_list"]=>
array(0) {
}
["field_count"]=>
int(5)
["host_info"]=>
string(25) "Localhost via UNIX socket"
["info"]=>
NULL
["insert_id"]=>
int(0)
["server_info"]=>
string(10) "5.5.52-cll"
["server_version"]=>
int(50552)
["stat"]=>
string(158) "Uptime: 8336177 Threads: 36 Questions: 5457298976 Slow queries: 4574 Opens: 25842187 Flush tables: 1 Open tables: 32768 Queries per second avg: 654.652"
["sqlstate"]=>
string(5) "00000"
["protocol_version"]=>
int(10)
["thread_id"]=>
int(72258564)
["warning_count"]=>
int(0)
}
["nameQuote":protected]=>
string(1) "`"
["nullDate":protected]=>
string(19) "0000-00-00 00:00:00"
["_database":"JDatabaseDriver":private]=>
string(14) "jozitrad_newww"
["count":protected]=>
int(61)
["cursor":protected]=>
NULL
["debug":protected]=>
bool(false)
["limit":protected]=>
int(0)
["log":protected]=>
array(0) {
}
["timings":protected]=>
array(0) {
}
["callStacks":protected]=>
array(0) {
}
["offset":protected]=>
int(0)
["options":protected]=>
array(9) {
["driver"]=>
string(6) "mysqli"
["host"]=>
string(9) "localhost"
["user"]=>
string(14) "jozitrad_newww"
["password"]=>
string(12) "removedddd"
["database"]=>
string(14) "jozitrad_newww"
["prefix"]=>
string(6) "ejkb4_"
["select"]=>
bool(true)
["port"]=>
int(3306)
["socket"]=>
NULL
}
["sql":protected]=>
string(177) "SELECT i.id,i.alias,i.code,i.catid,c.alias AS categoryalias
FROM #__k2_items as i
LEFT JOIN #__k2_categories c ON c.id = i.catid
WHERE i.published =1 AND i.id='9928481'"
["tablePrefix":protected]=>
string(6) "ejkb4_"
["utf":protected]=>
bool(true)
["utf8mb4":protected]=>
bool(true)
["errorNum":protected]=>
int(0)
["errorMsg":protected]=>
string(0) ""
["transactionDepth":protected]=>
int(0)
["disconnectHandlers":protected]=>
array(0) {
}
}
["_trackAssets":protected]=>
bool(false)
["_rules":protected]=>
NULL
["_locked":protected]=>
bool(false)
["_autoincrement":protected]=>
bool(true)
["_observers":protected]=>
object(JObserverUpdater)#493 (2) {
["observers":protected]=>
array(0) {
}
["doCallObservers":protected]=>
bool(true)
}
["_columnAlias":protected]=>
array(0) {
}
["_jsonEncode":protected]=>
array(0) {
}
["_errors":protected]=>
array(1) {
[0]=>
string(0) ""
}
["orderitem_id"]=>
int(135)
["order_id"]=>
int(1497952376)
["product_id"]=>
string(7) "9928481"
["orderitem_attributes"]=>
string(2) "{}"
["orderitem_attribute_names"]=>
string(2) "{}"
["orderitem_sku"]=>
string(17) "11111111222222222"
["orderitem_name"]=>
string(34) "Нов тестов продукт"
["orderitem_quantity"]=>
int(1)
["orderitem_price"]=>
float(0)
["orderitem_attributes_price"]=>
int(0)
["orderitem_discount"]=>
NULL
["orderitem_final_price"]=>
float(0)
["orderitem_tax"]=>
int(0)
["orderitem_shipping"]=>
NULL
["orderitem_shipping_tax"]=>
NULL
["orderitem_status"]=>
NULL
["modified_date"]=>
string(19) "2017-06-20 09:52:56"
["_isNew"]=>
bool(true)
}
Last edit: 7 years 5 months ago by Eduard Dimitrov. Reason: more data about question
Please Log in or Create an account to join the conversation.
- Eduard Dimitrov
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
7 years 5 months ago #162527
by Eduard Dimitrov
Replied by Eduard Dimitrov on topic Show K2 extra field data in external component like K2Store
P.S. Extra fields are displayed on K2 pages, i just want to show one specific extra field on k2 store cart and checkout pages.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 5 months ago #162530
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Show K2 extra field data in external component like K2Store
You can use a module and display only the fields of that item.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Eduard Dimitrov
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
7 years 5 months ago - 7 years 5 months ago #162533
by Eduard Dimitrov
Replied by Eduard Dimitrov on topic Show K2 extra field data in external component like K2Store
This is not an option. If I create module and configure to show in module some item, only this item will be shown. I must show on checkout page items in current order with ids and barcode custom field.
To show id i use:And it's working, but there is no custom fields data in query to database.
If possible, please, ask your K2 php programmers for some code with direct query to database - there is no problem to pay for this help. You can contact me on: admin att 3dwebdesign point org
Screen: imgur.com/a/K0AOO
To show id i use:
<?php echo $item->product_id; ?>
If possible, please, ask your K2 php programmers for some code with direct query to database - there is no problem to pay for this help. You can contact me on: admin att 3dwebdesign point org
Screen: imgur.com/a/K0AOO
Last edit: 7 years 5 months ago by Eduard Dimitrov.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 5 months ago #162552
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Show K2 extra field data in external component like K2Store
product_id is not a part of K2's core nor is TableOrderItems.
This means I do not know the relationship between orders and items.
Is the product_id stored in K2's tables as well?
This means I do not know the relationship between orders and items.
Is the product_id stored in K2's tables as well?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Eduard Dimitrov
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
7 years 5 months ago - 7 years 5 months ago #162556
by Eduard Dimitrov
Replied by Eduard Dimitrov on topic Show K2 extra field data in external component like K2Store
No, product_id come from k2store_products table - is the same as K2 item id, but saved in K2Store table. This is the reason why we need direct query to K2_items database table.
Last edit: 7 years 5 months ago by Eduard Dimitrov.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 5 months ago #162567
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Show K2 extra field data in external component like K2Store
If it is the same as the id then you can query the #__k2_items table and retrieve the data you need based on that id.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Show K2 extra field data in external component like K2Store