Would it be possible to create an SQL patch that accomplishes this? Or, am I not understanding how category and product titles are stored?
Would it be possible to create an SQL patch that accomplishes this? Or, am I not understanding how category and product titles are stored?
The OP wants to use only one database for all of these sites, and output keywords specific to each site.
Ah, okay. I missed that.
Stuck on this bit on the product_listing.php module
} else {
$lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['product_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listi ng->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
Bit in bold is the string that brings up the product name, but everything ive tried has brought it up blank.
You have a typo there - the field is products_name.
$listing->fields['products_name']
You haven't said exactly what happened when you tried the function. If you want your version to be more maintainable, you really need to develop a cleaner method than inserting a bunch of individualized PHP into every file you want to affect.
Yes sorry, ignore the Typo. It just came out blank where the text should have been. I'm not really concerned about the maintenance. I have a note of the files changed and the code is inserted at the top of each php file. I'd just like to get it working first then look at a way of doing a global function.
Posted via Mobile Device
A str_replace() example from the PHP manual:So the function as I posted ought to work the same way. What could be different in it or its context? (Single/double quotes don't count.)PHP Code:
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);
// Provides: You should eat pizza, beer, and ice cream every day
Right, I didnt continue with this, but I have another issue Im trying to get around.
I know that you cannot mark attributes temporarily out of stock, you have to delete them, and re-add them, or replace one with one that says 'out of stock' in the title of the attribute etc..
Now what about instead of all that, you mark the attribute display only so it can't be checked out, put a price factor of say +£999 to it, but then use my script I had at the beginning of this thread to replace the string '£999' with 'OUT OF STOCK.
This is the script below but I just can't seem to get it to hit the right element. Ive tried elements such as form, input, select, attrib-12 (which is what my css is telling me) but none of them work..
<script language="javascript" type="text/javascript">
function replaceWord(control, oldWord, newWord) {
var pageElement = document.getElementById(control);
oldWord = new RegExp(oldWord, "g");
if (pageElement.value)
pageElement.value = pageElement.value.replace(oldWord, newWord);
else
pageElement.innerHTML = pageElement.innerHTML.replace(oldWord, newWord);
}
</script>
<div id="page">
<body onload="replaceWord('FORM', '+£999.00', 'Out Of Stock')" />
So Ive come back to this original thought, as on further thinking it really does have good uses.
Im fine on static titles, like category titles on a listing, or product titles and description on a product page, but when there is a listing with more than one product title or category title on a page (such as categories sidebox or a category listing lots of products, I get stuck.
If I do what ive been doing so far, I get one category in the side box to change its title, but then all the others vanish, like wise, I can get one product in a listing to change, and all the others vanish.
I assume because Im modifiying an array, and not a fixed string.
For example, in tpl_columnar display... I had a listing of 157 products, but this makes only one appear with the correct name, and the other 156 vanish off the page. Any ideas?
<?php
// The text string
$list_box_contents2[$row][$col] = $list_box_contents[$row][$col];
// The word we want to replace
$oldWordprodtitle = "oldword";
// The new word we want in place of the old one
$newWordprodtitle = "newword";
// Run through the text and replaces all occurrences of $oldText
$list_box_contents2[$row][$col] = str_replace($oldWordprodtitle , $newWordprodtitle , $list_box_contents2[$row][$col]);
?>
<?php
/**
* Common Template - tpl_columnar_display.php
*
* This file is used for generating tabular output where needed, based on the supplied array of table-cell contents.
*
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_columnar_display.php 3157 2006-03-10 23:24:22Z drbyte $
*/
?>
<?php
if ($title) {
?>
<?php echo $title; ?>
<?php
}
?>
<?php
if (is_array($list_box_contents) > 0 ) {
for($row=0;$row<sizeof($list_box_contents);$row++) {
$params = "";
//if (isset($list_box_contents[$row]['params'])) $params .= ' ' . $list_box_contents[$row]['params'];
?>
<?php
for($col=0;$col<sizeof($list_box_contents[$row]);$col++) {
$r_params = "";
if (isset($list_box_contents[$row][$col]['params'])) $r_params .= ' ' . (string)$list_box_contents[$row][$col]['params'];
if (isset($list_box_contents[$row][$col]['text'])) {
?>
<?php echo '<div' . $r_params . '>' . $list_box_contents2[$row][$col]['text'] . '</div>' . "\n"; ?>
<?php
}
}
?>
<br class="clearBoth" />
<?php
}
}
?>
Bookmarks