Новости Joomla

Перевод и публикация интервью с Joomla евангелистом на греческом портале Joomla

Перевод и публикация интервью на греческом портале Joomla 🇬🇷

Утро, просматриваешь входящие письма и изучаешь новости и внезапно обнаруживаешь, что инициатива, которую ты начал, подхватывается другими людьми. 🎉

Недавно я взял интервью у Билла (Василиса) Коциаса - руководителя студии, читающего лекции в университете и популяризатора Joomla в Греции. Это интервью из журнала NorrNext, в оригинале на английском, теперь доступно на греческом языке и опубликовано на портале joomla.gr. 🎉

До чего же приятно… 😇😊 Работа замечена и с ней посчитали необходимым ознакомить аудиторию страны, в которой Билл читает лекции. И это солнечная Греция - страна, страна, с которой Россию многое связывает. 🇬🇷🇷🇺🕊

Смотрю на греческий алфавит и тут же рисуются картины белоснежных зданий в окружении винограда и амфор, красивых женщин в сандалиях и мужественных воинов, охраняющих покой полисов, в которых ученые мужи работают над трудами, позже вошедшими в века. Красиво! 😇Но вернемся к интервью.

Из него вы узнаете, что в Греции доля Joomla среди CMS занимает порядка 30-40%. По моему мнению это - самый высокий показатель во всем мире. Также чтение лекций о Joomla в университетах позволит привести новых пользователей и к тому же молодое поколение. Ну и огромное кол-во сертификтатов Билла на стене (смотрим фото в статье) свидетельствует о том, что Joomla может применяться как профессиональный инструмент.

🌐 Оригинальное интервью (на английском)
🇬🇷 Интервью на греческом портале (joomla.gr)

Что насчет перевода на русский? Увы, времени всего 24 часа в сутках. Я продолжаю готовить новые интервью. Возможно, после завершения выпуска журнала, рассмотрю перевод некоторых интервью на русский. Но я об этом не говорил. 😊 В блоге @eugenius_blog публикую анонсы интересных событий из мира Joomla, интервью, уроки и полезные советы, а также делюсь мыслями:, связанными с разработкой и веб-дизайном.

Обработка HTTP ответа в Joomla 6+. Изменения по сравнению с Joomla 3 - Joomla 5

👩‍💻 Обработка HTTP ответа в Joomla 6+. Изменения по сравнению с Joomla 3 - Joomla 5.В Joomla для выполнения внешних запросов из PHP к сторонним API используется класс Joomla\Http\Http напрямую или же Joomla\Http\HttpFactory, который возвращает для работы преднастроенный по умолчанию класс Http. О работе с HTTP-запросами подробно рассказывалось в статье 2021 года Создание внешних запросов с использованием HttpFactory (Joomla). Некоторые изменения касаются работы с ответами на запросы. Например, наш запрос:
use Joomla\Http\HttpFactory;$http = (new HttpFactory)->getHttp($options, ['curl', 'stream']);$response = $http->get('https://any-url.ru/api/any/endpoint');
Раньше можно было получить код ответа или тело ответа как свойство $response - $response->code или $response->body. Однако, Joomla, начиная с Joomla 4 во многом переходит на стандарты PSR. В частности для работы с HTTP-ответами - на PSR-7. Также хорошая статья на Хабре о PSR-7: PSR-7 в примерах.
Прямое обращение к свойствам code, headers, body объявлено устаревшим в Joomla 6.0.0 и обещают удалить в Joomla 7.0.0.
Вместо этого нужно работать с HTTP-ответом по стандартам PSR-7. Код ответа.Было $response->code. Стало $response->getStatusCode().Заголовки ответа.Было $response->headers. Стало $response->getHeaders().Тело ответа.Было $response->body. Стало (string)$response->getContents().В тело ответа теперь приходит не строка, а поток - объект класса Laminas\Diactoros\Stream. Поэтому его нужно привести к строке (если это json, к примеру): (string)$response->getContents(). Чаще всего в коде Joomla встречается именно такой вариант. Однако, есть и вариант с перемещением указателя чтения на начало потока:
// Получили ответ в виде потока$stream = $response->getBody();// "перемотали" на начало$stream->rewind();// Получили строковый ответ$json = $stream->getContents();
В итоге результат одинаковый.@joomlafeed#joomla #разработка #php

0 Пользователей и 1 Гость просматривают эту тему.
  • 3 Ответов
  • 3006 Просмотров
*

arm1n

  • Осваиваюсь на форуме
  • 12
  • 0 / 0
Доброго времени суток.Требуется помощь в выводе атрибута корзины selectom, сейчас вывод работает через radio button, собственно вот
http://cotelnay.com.ua/vodonagrevateli/boiler/ariston-sg-kupit
Помогите пожалуйста разобраться


Код
public function getProductCustomsFieldCart ($product) {

// group by virtuemart_custom_id
$query = 'SELECT C.`virtuemart_custom_id`, `custom_title`, C.`custom_value`,`custom_field_desc` ,`custom_tip`,`field_type`,field.`virtuemart_customfield_id`,`is_hidden`
FROM `#__virtuemart_customs` AS C
LEFT JOIN `#__virtuemart_product_customfields` AS field ON C.`virtuemart_custom_id` = field.`virtuemart_custom_id`
Where `virtuemart_product_id` =' . (int)$product->virtuemart_product_id . ' and `field_type` != "G" and `field_type` != "R" and `field_type` != "Z"';
$query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id ORDER BY field.`ordering`';

$this->_db->setQuery ($query);
$groups = $this->_db->loadObjectList ();

if (!class_exists ('VmHTML')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php');
}
$row = 0;
if (!class_exists ('CurrencyDisplay')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php');
}
$currency = CurrencyDisplay::getInstance ();

if (!class_exists ('calculationHelper')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php');
}
$calculator = calculationHelper::getInstance ();
if (!class_exists ('vmCustomPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php');
}

$free = JText::_ ('COM_VIRTUEMART_CART_PRICE_FREE');
// render select list
foreach ($groups as $group) {

// $query='SELECT  field.`virtuemart_customfield_id` as value ,concat(field.`custom_value`," :bu ", field.`custom_price`) AS text
$query = 'SELECT field.`virtuemart_product_id`, `custom_params`,`custom_element`, field.`virtuemart_custom_id`,
field.`virtuemart_customfield_id`,field.`custom_value`, field.`custom_price`, field.`custom_param`
FROM `#__virtuemart_customs` AS C
LEFT JOIN `#__virtuemart_product_customfields` AS field ON C.`virtuemart_custom_id` = field.`virtuemart_custom_id`
Where `virtuemart_product_id` =' . (int)$product->virtuemart_product_id;
$query .= ' and is_cart_attribute = 1 and C.`virtuemart_custom_id`=' . (int)$group->virtuemart_custom_id;

// We want the field to be ordered as the user defined
$query .= ' ORDER BY field.`ordering`';

$this->_db->setQuery ($query);
$options = $this->_db->loadObjectList ();
//vmdebug('getProductCustomsFieldCart options',$options);
$group->options = array();
foreach ($options as $option) {
$group->options[$option->virtuemart_customfield_id] = $option;
}

if ($group->field_type == 'V') {
$default = current ($group->options);
foreach ($group->options as $productCustom) {
if ((float)$productCustom->custom_price) {
$price = strip_tags ($currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($productCustom->custom_price)));
}
else {
$price = ($productCustom->custom_price === '')? '' : $free;
}
$productCustom->text = $productCustom->custom_value . ' ' . $price;

}
$group->display = VmHTML::select ('customPrice[' . $row . '][' . $group->virtuemart_custom_id . ']', $group->options, $default->custom_value, '', 'virtuemart_customfield_id', 'text', FALSE);
}
else {
if ($group->field_type == 'G') {
$group->display .= ''; // no direct display done by plugin;
}
else {
if ($group->field_type == 'E') {
$group->display = '';

foreach ($group->options as $k=> $productCustom) {
if ((float)$productCustom->custom_price) {
$price = $currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($productCustom->custom_price));
}
else {
$price = ($productCustom->custom_price === '')? '' : $free;
}
$productCustom->text = $productCustom->custom_value . ' ' . $price;
$productCustom->virtuemart_customfield_id = $k;
if (!class_exists ('vmCustomPlugin')) {
require(JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php');
}

//legacy, it will be removed 2.2
$productCustom->value = $productCustom->virtuemart_customfield_id;
JPluginHelper::importPlugin ('vmcustom');
$dispatcher = JDispatcher::getInstance ();
$fieldsToShow = $dispatcher->trigger ('plgVmOnDisplayProductVariantFE', array($productCustom, &$row, &$group));

// $group->display .= '<input type="hidden" value="' . $k . '" name="customPrice[' . $row . '][' . $group->virtuemart_custom_id . ']" /> ';
$group->display .= '<input type="hidden" value="' . $productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /> ';
if (!empty($currency->_priceConfig['variantModification'][0]) and $price !== '') {
$group->display .= '<div class="price-plugin">' . JText::_ ('COM_VIRTUEMART_CART_PRICE'). '<span class="price-plugin">' . $price . '</span></div>';
}
$row++;
}
$row--;
}
else {
if ($group->field_type == 'U') {
foreach ($group->options as $productCustom) {
if ((float)$productCustom->custom_price) {
$price = $currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($productCustom->custom_price));
}
else {
$price = ($productCustom->custom_price === '')? '' : $free;
}
$productCustom->text = $productCustom->custom_value . ' ' . $price;

$group->display .= '<input type="text" value="' . JText::_ ($productCustom->custom_value). '" name="customPrice[' . $row . '][' . $group->virtuemart_custom_id . '][' . $productCustom->value . ']" /> ';
if (!empty($currency->_priceConfig['variantModification'][0]) and $price !== '') {
$group->display .= '<div class="price-plugin">' . JText::_ ('COM_VIRTUEMART_CART_PRICE'). '<span class="price-plugin">' . $price . '</span></div>';
}
}
}
else {
if ($group->field_type == 'A') {
$group->display = '';
foreach ($group->options as $productCustom) {
/* if ((float)$productCustom->custom_price) {
$price = $currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($productCustom->custom_price));
}
else {
$price = ($productCustom->custom_price === '')? '' : $free;
}*/
$productCustom->field_type = $group->field_type;
$productCustom->is_cart = 1;
$group->display .= $this->displayProductCustomfieldFE ($product, $productCustom, $row);
$checked = '';
}
}
else {

$group->display = '';
$checked = 'checked="checked"';
foreach ($group->options as $productCustom) {
//vmdebug('getProductCustomsFieldCart',$productCustom);
if ((float)$productCustom->custom_price) {
$price = $currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($productCustom->custom_price));
}
else {
$price = ($productCustom->custom_price === '')? '' : $free;
}
$productCustom->field_type = $group->field_type;
$productCustom->is_cart = 1;
// $group->display .= '<input id="' . $productCustom->virtuemart_custom_id . '" ' . $checked . ' type="radio" value="' .
// $productCustom->virtuemart_custom_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_customfield_id . ']" /><label
// for="' . $productCustom->virtuemart_custom_id . '">' . $this->displayProductCustomfieldFE ($productCustom, $row). ' ' . $price . '</label>';
//MarkerVarMods
$group->display .= '<input id="' . $productCustom->virtuemart_custom_id . '" ' . $checked . ' type="radio" value="' .
$productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /><label
for="' . $productCustom->virtuemart_custom_id . '">' . $this->displayProductCustomfieldFE ($product, $productCustom, $row). ' ' . $price . '</label>';

$checked = '';
}
}
}
}
}
}
$row++;
}

return $groups;

}
« Последнее редактирование: 20.03.2013, 15:00:30 от arm1n »
*

arm1n

  • Осваиваюсь на форуме
  • 12
  • 0 / 0
Решено, можно закрывать тему
*

Inmixxx

  • Новичок
  • 1
  • 0 / 0
Расскажите пожалуйста. Какой код править, чтобы в атрибуте корзины выбрать select вместо radio. т.е. мне нужно выбрать комплектующие для мебели например ящик, полка дополнительная и т.д.
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Файл дополнительного поля изображения

Автор web3.0

Ответов: 0
Просмотров: 2721
Последний ответ 16.05.2020, 15:59:09
от web3.0
Как сменить изображение стандартной кнопки(зеленой) добавления корзины?

Автор Дмитрий Ф.

Ответов: 13
Просмотров: 11452
Последний ответ 23.01.2020, 15:30:09
от Amikta
При смене позиции модуля корзины, не добавляется товар

Автор Dolphin4ik_1

Ответов: 1
Просмотров: 980
Последний ответ 28.12.2018, 20:22:03
от fsv
Появление корзины в докбаре

Автор Dolphin4ik_1

Ответов: 5
Просмотров: 956
Последний ответ 27.12.2018, 22:19:22
от Dolphin4ik_1
Появление корзины после добавления товара

Автор Dolphin4ik_1

Ответов: 1
Просмотров: 924
Последний ответ 27.12.2018, 19:27:50
от Dolphin4ik_1