Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Questions (/forumdisplay.php?f=67)
-   -   remove part of product description (/showthread.php?t=5193)

astran September 16th, 2011 08:31 AM

remove part of product description
 
Hi Eric,

Some merchant has their name as part of product description, how can I remove them

for example Zappos inserts "Zappos.com is proud to offer the" in the first part of its product description

Thanks

Eric September 16th, 2011 09:33 AM

You can edit the products manually by clicking the "more info" link for the product in the Factory.

astran September 16th, 2011 12:30 PM

Zappos has thousand of products - I can not change the description manually


In "HTML for the <head> element" in "product detail"

we have "<meta name="description" content="[product.description]" />"

How can we modify the "content" to get rid of "Zappos.com is proud to offer the"

Eric September 16th, 2011 12:31 PM

Well, you could use PHP's substr() or str_replace() function to strip out specific text from the $product->description variable. That's really your only choice.

astran September 16th, 2011 02:30 PM

I am not a programmer - please show me how to use PHP's substr() function to remove "Zappos.com is proud to offer the" in the $product->description

Eric September 16th, 2011 02:38 PM

<?php echo str_replace("Zappos.com is proud to offer the", "", $product->description); ?>

More examples and usages here: http://php.net/manual/en/function.str-replace.php

meinehandtasche November 21st, 2011 05:42 AM

Store ID: 32722
Website URL: www.meinehandtasche.de
URL to page in question:

Hi,

In which file I need to insert this code?
Quote:

<?php echo str_replace("Zappos.com is proud to offer the", "", $product->description); ?>
Best,
Oliver

Eric November 21st, 2011 09:50 AM

Hi

The other user was referring to this section:

The Factory > Your Store > VIEWS > PRODUCT DETAIL > Default > View menu > View <head> Elements in the meta description tag.

Eric

meinehandtasche November 23rd, 2011 02:57 AM

replace string from product titel
 
Hi,

how can I replace a string like "- bei Yoox.com" from the product title?

I tried to insert it this way in //Views > Product detail > edit template// but didn't work.

Quote:

<?php echo str_replace(" - bei YOOX.COM", "", $category->description); ?>

<!-- Single Product -->
<div class="sp">
<div class="lc">
<div class="thmb">
<a href="[product.url direct='0']" title="[product.name]" target="_blank" rel="nofollow">
<img src="[product.image]" width="250" />
</a>
</div>



</div>
<div class="rc">
<h2><a href="[product.url direct='0']" title="[product.name]" target="_blank" rel="nofollow">[product.name]</a></h2>
<p class="desc">[product.description]</p>
<div>
[product.each_tag]<?php if($nn>1){echo ', ';}?><a href="[tag.link]"><?php echo str_replace("-"," ",$tag->name);?></a>[product.end]
</div>
<div class="prc">[product.currency mode="word"][product.price]</div>
<div class="btns">
<a href="javascript:window.history.go(-1)" class="dfbutton dfsilver dflarge" title="Zurck zur letzten Seite">zurck</a>
<a href="[product.url]" class="dfbutton dforange dflarge" title="Jetzt kaufen" target="_blank" rel="nofollow">Bestellen</a>
</div>
</div>
<div class="clearingdiv"> </div>
</div>
<!-- /Single Product -->

I already asked a similar question but do you have a solution if I want a freelancer to re-write the product description for SEO purpose without providing access to the factory? Like: exporting all products in a csv file and importing it back.
If not might this be worth to be a comming feature?

Thanks,
Oliver

Eric November 23rd, 2011 08:19 AM

Hi

You're almost there. You need this:
PHP Code:

<?php $pname str_replace(" - bei YOOX.COM"""$product->name); ?>

But where the product name appears you need to use <?php echo $pname; ?> instead of [product.name].

Eric

meinehandtasche November 23rd, 2011 08:35 AM

This worked just fine! :-)
Thank you so much!

Here for others the code how it looks in the end. I just have to do the same on the view category.


here the detail view:

Quote:

<?php $pname = str_replace(" - bei YOOX.COM", "", $product->name); ?>


<!-- Single Product -->
<div class="sp">
<div class="lc">
<div class="thmb">
<a href="[product.url direct='0']" title="<?php echo $pname; ?>" target="_blank" rel="nofollow">
<img src="[product.image]" width="250" />
</a>
</div>



</div>
<div class="rc">
<h2><a href="[product.url direct='0']" title="<?php echo $pname; ?>" target="_blank" rel="nofollow"><?php echo $pname; ?></a></h2>
<p class="desc">[product.description]</p>
<div>
[product.each_tag]<?php if($nn>1){echo ', ';}?><a href="[tag.link]"><?php echo str_replace("-"," ",$tag->name);?></a>[product.end]
</div>
<div class="prc">[product.currency mode="word"][product.price]</div>
<div class="btns">
<a href="javascript:window.history.go(-1)" class="dfbutton dfsilver dflarge" title="Zurck zur letzten Seite">zurck</a>
<a href="[product.url]" class="dfbutton dforange dflarge" title="Jetzt kaufen" target="_blank" rel="nofollow">Bestellen</a>
</div>
</div>
<div class="clearingdiv"> </div>
</div>
<!-- /Single Product -->

meinehandtasche November 23rd, 2011 08:50 AM

hmmm... for the category view somehow it didn't work that way.
When I change the code this way the headline won't be displayed.

What am I doing wrong again?

What I did:
Inserting this line
Quote:

<?php $pname = str_replace(" - bei YOOX.COM", "", $product->name); ?>
and changing to <?php echo $pname; ?> instead of [product.name]

Quote:

<?php $pname = str_replace(" - bei YOOX.COM", "", $product->name); ?>

<!-- Product List -->
<div class="pl">
[product.each]
<div class="t3 col1">
<div class="bdr">
<div class="lc">
<div class="thmb"><a href="[product.link]" title="<?php echo $pname; ?>">[product.image tag='1']</a></div>
<div class="prc">[product.currency mode='word'] [product.price]</div>
</div>
<div class="rc">
<h2><a href="[product.link]" title="<?php echo $pname; ?>"><?php echo $pname; ?></a></h2>
<p class="desc">[product.description]</p>
<div class="btns">
<a href="[product.link]" title="<?php echo $pname; ?>" class="dfbutton dfblue dflarge">Details</a>
<a href="[product.url direct='0']" title="<?php echo $pname; ?>" class="dfbutton dforange dflarge">bestellen</a>
</div>
</div>
<div class="clearingdiv"> </div>
</div>
</div>
[product.end]
<div class="clearingdiv"> </div>
</div>
<!-- /Product List -->

Eric November 23rd, 2011 09:13 AM

Hi

You should place the first PHP code immediately after the [product.each] tag.

...
[product.each]
<?php $pname = str_replace(" - bei YOOX.COM", "", $product->name); ?>
...

Eric

meinehandtasche November 23rd, 2011 09:59 AM

This works now as well. Thanks!! :-)

Quote:

<!-- Product List -->
<div class="pl">
[product.each]
<?php $pname = str_replace(" - bei YOOX.COM", "", $product->name); ?>

<div class="t3 col1">
<div class="bdr">
<div class="lc">
<div class="thmb"><a href="[product.link]" title="<?php echo $pname; ?>">[product.image tag='1']</a></div>
<div class="prc">[product.currency mode='word'] [product.price]</div>
</div>
<div class="rc">
<h2><a href="[product.link]" title="<?php echo $pname; ?>"><?php echo $pname; ?></a></h2>
<p class="desc">[product.description]</p>
<div class="btns">
<a href="[product.link]" title="<?php echo $pname; ?>" class="dfbutton dfblue dflarge">Details</a>
<a href="[product.url direct='0']" title="<?php echo $pname; ?>" class="dfbutton dforange dflarge">bestellen</a>
</div>
</div>
<div class="clearingdiv"> </div>
</div>
</div>
[product.end]
<div class="clearingdiv"> </div>
</div>
<!-- /Product List -->


All times are GMT -5. The time now is 12:56 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.