Categories
February 15, 2024
Cross Sell
$row) {
$name = $row['crosssell_name'] ?? '';
if (!$name) {
continue;
}
$target = sanitize_title($name);
if (isset($used_targets[$target])) {
$target = $target . '-' . ($index + 1);
}
$used_targets[$target] = true;
$icon = $row['crosssell_icon'] ?? '';
$hover_icon = $row['crosssell_hover_icon'] ?? '';
// Fallback for the typo version, if the ACF field was created that way.
if (!$hover_icon && !empty($row['crossell_hover_icon'])) {
$hover_icon = $row['crossell_hover_icon'];
}
$items[] = [
'target' => $target,
'name' => $name,
'icon_url' => lsg_crosssell_image_url($icon, 'thumbnail'),
'hover_icon_url' => lsg_crosssell_image_url($hover_icon, 'thumbnail'),
'body_image' => $row['crosssell_body_image'] ?? '',
'body_title' => $row['crosssell_body_title'] ?? '',
'body_text' => $row['crosssell_body_text'] ?? '',
'button_text' => $row['crosssell_body_button_text'] ?? '',
'button_url' => $row['crosssell_body_button_url'] ?? '',
'crosssell_url' => $row['crosssell_url'] ?? '',
'card_text' => $row['crosssell_text'] ?? '',
];
}
if (empty($items)) {
return;
}
?>