Author Topic: Product thumbnails on admin products list  (Read 615 times)

Huraganek

  • Beginner
  • *
  • Posts: 6
  • A beginner
Product thumbnails on admin products list
« on: December 13, 2017, 13:46:31 pm »
Hello,
I have small problem, I cannot to get product thumbnail url on product list in joomla VM administrator area. When I use
Code: [Select]
$product->virtuemart_media_id[0]
I get media id, but when I try
Code: [Select]
$this->product->file_urlI get nothing. On product detail in admin it works. I've tried using getThumbUrl function but it makes my admin template disaster. On image I show where I want see thumbnail. Please help me! :)


Virtuemart 3.0.18

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 7705
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Product thumbnails on admin products list
« Reply #1 on: December 13, 2017, 15:20:54 pm »
$product->images[0]->displayMediaThumb('class="vm_mini_image"',false )    ??

it won't be $this what ever u use
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 2974
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Product thumbnails on admin products list
« Reply #2 on: December 13, 2017, 15:23:37 pm »
$product->virtuemart_media_id[0]
and
$this->product->file_url
one time you use $this->product and other time $product
I think it is $product, but to get medias, you need to add it using $product_model->addImages($product,1); if this are not set
and
Code: [Select]
if (!empty($product->images)) {
$image = $product->images[0];
echo $image->displayMediaThumb('class="thumbnail"',false ) ;
}

Huraganek

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: Product thumbnails on admin products list
« Reply #3 on: December 13, 2017, 16:15:46 pm »
Unfortunatly it doesn't work.

I am trying to put this code as You said, and I have blank page ...

Im writting this code in views/product/tmpl/default.php file...

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 7705
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Product thumbnails on admin products list
« Reply #4 on: December 13, 2017, 17:43:19 pm »
echo out what $product gives u
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 2974
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Product thumbnails on admin products list
« Reply #5 on: December 13, 2017, 21:55:10 pm »
Try first with the code of GJC Web Design
Else with $product_model, you need to load it before.
Are you a dev or simple user ?

Huraganek

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: Product thumbnails on admin products list
« Reply #6 on: December 14, 2017, 16:35:18 pm »
echo out what $product gives u

echo $product;

gives me blank page...

Try first with the code of GJC Web Design
Else with $product_model, you need to load it before.
Are you a dev or simple user ?

I am simple user, with very small dev knowledge, but want to learn :)

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 7705
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Product thumbnails on admin products list
« Reply #7 on: December 16, 2017, 19:28:32 pm »
print 'Debug Line '.__LINE__.' $product <pre>'; print_r ($product); print "</pre><br />\n";

but if u want to learn you should start by researching some basic php knowledge..  e.g. u can't echo an object

I meant find out what is currently present in the $product object
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Huraganek

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: Product thumbnails on admin products list
« Reply #8 on: May 17, 2018, 10:36:34 am »
Sorry for digging old topic, but still I can't show those thumbnails ;/


When I vardump product on administrator product list I get

Quote
   object(TableProducts)#394 (94) { ["virtuemart_product_id"]=> string(5) "20585" ["virtuemart_vendor_id"]=> string(1) "1" ["product_parent_id"]=> string(1) "0" ["product_sku"]=> NULL ["product_gtin"]=> NULL ["product_mpn"]=> NULL ["product_name"]=> string(4) "test" ["slug"]=> string(4) "test" ["product_s_desc"]=> string(0) "" ["product_desc"]=> string(0) "" ["product_weight"]=> NULL ["product_weight_uom"]=> NULL ["product_length"]=> NULL ["product_width"]=> NULL ["product_height"]=> NULL ["product_lwh_uom"]=> NULL ["product_url"]=> string(0) "" ["product_in_stock"]=> int(0) ["product_ordered"]=> string(1) "0" ["low_stock_notification"]=> string(1) "0" ["product_available_date"]=> string(19) "0000-00-00 00:00:00" ["product_availability"]=> NULL ["product_special"]=> NULL ["pordering"]=> string(1) "0" ["product_sales"]=> string(1) "0" ["product_unit"]=> NULL ["product_packaging"]=> NULL ["product_params"]=> string(81) "min_order_level=null|max_order_level=null|step_order_level=null|product_box=null|" ["intnotes"]=> string(0) "" ["customtitle"]=> string(0) "" ["metadesc"]=> string(0) "" ["metakey"]=> string(0) "" ["metarobot"]=> string(0) "" ["metaauthor"]=> string(0) "" ["layout"]=> string(1) "0" ["published"]=> string(1) "1" ["_lhash":"VmTable":private]=> string(32) "3e33094aa432e0e57e920dfc88cec330" ["_tbl":protected]=> string(22) "#__virtuemart_products" ["_tbl_lang":protected]=> string(28) "#__virtuemart_products_pl_pl" ["_tbl_key":protected]=> string(21) "virtuemart_product_id" ["_tbl_keys":protected]=> array(1) {
  • => string(21) "virtuemart_product_id" } ["_pkey":protected]=> string(21) "virtuemart_product_id" ["_pkeyForm":protected]=> string(3) "cid" ["_obkeys":protected]=> array(2) { ["product_name"]=> int(1) ["slug"]=> int(1) } ["_unique":protected]=> bool(true) ["_unique_name":protected]=> array(1) { ["slug"]=> int(1) } ["_orderingKey":protected]=> string(8) "ordering" ["_slugAutoName":protected]=> string(12) "product_name" ["_slugName":protected]=> string(4) "slug" ["_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(1) ["host_info"]=> string(30) "sql.MYNAME.myhost.com via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(21) "5.5.5-10.1.26-MariaDB" ["server_version"]=> int(50505) ["stat"]=> string(167) "Uptime: 4691370 Threads: 19 Questions: 5947625949 Slow queries: 415895 Opens: 89405641 Flush tables: 1949266 Open tables: 16384 Queries per second avg: 1267.780" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(93668858) ["warning_count"]=> int(0) } ["nameQuote":protected]=> string(1) "`" ["nullDate":protected]=> string(19) "0000-00-00 00:00:00" ["_database":"JDatabaseDriver":private]=> string(8) "MYNAME_2" ["count":protected]=> int(258) ["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(19) "sql.MYNAME.myhost.com" ["user"]=> string(8) "MYNAME_2" ["password"]=> string(14) "fG%73;(Tybd!fd" ["database"]=> string(8) "MYNAME_2" ["prefix"]=> string(6) "roqmx_" ["select"]=> bool(true) ["port"]=> int(3306) ["socket"]=> NULL } ["sql":protected]=> string(81) " SELECT COUNT( * ) FROM `#__virtuemart_products` WHERE `product_parent_id` =20585" ["tablePrefix":protected]=> string(6) "roqmx_" ["utf":protected]=> bool(true) ["utf8mb4":protected]=> bool(true) ["errorNum":protected]=> int(0) ["errorMsg":protected]=> string(0) "" ["transactionDepth":protected]=> int(0) ["disconnectHandlers":protected]=> array(0) { } } ["_rules":protected]=> NULL ["_trackAssets":protected]=> bool(false) ["_locked":protected]=> bool(false) ["_loggable":protected]=> bool(true) ["_xParams"]=> string(14) "product_params" ["_varsToPushParam"]=> array(4) { ["min_order_level"]=> array(2) {
  • => NULL [1]=> string(5) "float" } ["max_order_level"]=> array(2) {
  • => NULL [1]=> string(5) "float" } ["step_order_level"]=> array(2) {
  • => NULL [1]=> string(5) "float" } ["product_box"]=> array(2) {
  • => NULL [1]=> string(5) "float" } } ["_translatable"]=> bool(true) ["_translatableFields":protected]=> array(7) {
  • => string(12) "product_name" [1]=> string(14) "product_s_desc" [2]=> string(12) "product_desc" [3]=> string(8) "metadesc" [4]=> string(7) "metakey" [5]=> string(11) "customtitle" ["slug"]=> string(4) "slug" } ["_cryptedFields"]=> bool(false) ["_langTag":protected]=> string(5) "pl_pl" ["_ltmp"]=> bool(false) ["_loaded"]=> bool(true) ["_updateNulls":protected]=> bool(true) ["_tablePreFix"]=> string(2) "p." ["_autoincrement"]=> bool(true) ["_observers"]=> object(JObserverUpdater)#404 (2) { ["observers":protected]=> array(0) { } ["doCallObservers":protected]=> bool(true) } ["created_on"]=> string(19) "2018-05-17 08:33:23" ["created_by"]=> string(3) "530" ["modified_on"]=> string(19) "2018-05-17 08:33:23" ["modified_by"]=> string(3) "530" ["min_order_level"]=> NULL ["max_order_level"]=> NULL ["step_order_level"]=> NULL ["product_box"]=> NULL ["allIds"]=> array(0) { } ["virtuemart_media_id"]=> array(1) {
  • => string(5) "22129" } ["shoppergroups"]=> bool(false) ["allPrices"]=> array(1) {
  • => array(19) { ["virtuemart_product_price_id"]=> string(5) "10561" ["virtuemart_product_id"]=> string(5) "20585" ["virtuemart_shoppergroup_id"]=> string(1) "0" ["product_price"]=> string(10) "100.000000" ["override"]=> string(1) "0" ["product_override_price"]=> NULL ["product_tax_id"]=> string(1) "0" ["product_discount_id"]=> string(1) "0" ["product_currency"]=> string(3) "114" ["product_price_publish_up"]=> string(19) "0000-00-00 00:00:00" ["product_price_publish_down"]=> string(19) "0000-00-00 00:00:00" ["price_quantity_start"]=> string(1) "0" ["price_quantity_end"]=> string(1) "0" ["created_on"]=> string(19) "2018-05-17 08:33:23" ["created_by"]=> string(3) "530" ["modified_on"]=> string(19) "2018-05-17 08:33:23" ["modified_by"]=> string(3) "530" ["locked_on"]=> string(19) "0000-00-00 00:00:00" ["locked_by"]=> string(1) "0" } } ["selectedPrice"]=> int(0) ["virtuemart_manufacturer_id"]=> array(0) { } ["mf_name"]=> string(0) "" ["mf_desc"]=> string(0) "" ["mf_url"]=> string(0) "" ["categoryItem"]=> array(0) { } ["canonCatId"]=> bool(false) ["virtuemart_category_id"]=> string(0) "" ["category_name"]=> string(0) "" ["ordering"]=> string(0) "" ["id"]=> int(0) ["mediaitems"]=> int(1) ["reviews"]=> string(1) "0" ["product_price_display"]=> string(10) "100,00 zł" ["categoriesList"]=> string(0) "" ["manuList"]=> string(0) "" }

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 2974
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Product thumbnails on admin products list
« Reply #9 on: May 17, 2018, 11:18:18 am »
Huraganek, in the VM config >Templates
you have to increase  : Max items listed displaying media to 50 or 100 for eg.

Huraganek

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: Product thumbnails on admin products list
« Reply #10 on: May 17, 2018, 11:41:12 am »
Huraganek, in the VM config >Templates
you have to increase  : Max items listed displaying media to 50 or 100 for eg.

ok, I've done this but it didn't change anything - what it should do?

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26813
  • Always on vacation
    • Jenkin Hill Internet
Re: Product thumbnails on admin products list
« Reply #11 on: May 17, 2018, 11:52:15 am »
There is a configurable limit for thumb display to prevent resource issues when generating thumbs in long lists.

The setting in Config/Templates/Set the pagination sequence for the List Box   for "Backend default items per list view" should be lower than the setting for "Max items listed displaying media"

Start with a list view number of 30, for example and max items as 50 and you should see the thumbs.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM3.2.14.9808 on Joomla 3.8.8 PHP 7.0.30

Testing VM3.2.15.9840 on J3.8.8

Huraganek

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: Product thumbnails on admin products list
« Reply #12 on: May 17, 2018, 12:55:54 pm »
ok, I think that I've done it with this code
Quote
$this->model->addImages($product,1);
                 if (!empty($product->images)) {
   $image = $product->images[0];
   echo $image->displayMediaThumb('class="thumbnail"',false ) ;
} ?>

One more question in which file I can find displayMediaThumb function??