Hi,

Would it be possible to add the option to select an image field from the Product Display-node in stead of the referenced products at admin/config/services/mailchimp/ecommerce ?

PS: I'm using the latest github-version of the module.

Best,

Comments

kristofferrom created an issue. See original summary.

greg boggs’s picture

That would be a fine addition! Pull Requests are welcome.

kristofferrom’s picture

Cool, but can I create a pull request without contributing to the code?
I'd love to contribute but coding-skills aren't sufficient...

torgospizza’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new2.1 KB

Here's a patch that should work! It adds image fields from the chosen node (product display) type.

Then, when building the image_url, looks for the image on the product first; if it's not found there, it will try the display node. This means that you will want to avoid having the same image field machine_name on both your display node types and product entity types.

torgospizza’s picture

StatusFileSize
new2.76 KB

Whoops, forgot to include the change to the admin form. New patch attached.

RaphaelBriskie’s picture

@torgosPizza the latest patch is missing

$field_name = variable_get('mailchimp_ecommerce_commerce_image_field', '');

Without it, you'll get a lot of "variable undefined" errors.

Additionally, the following code:

if ($wrapper->__isset($field_name) && $wrapper->{$field_name}->value()) {
  $image = strip_tags($wrapper->{$field_name}->value());
}

Provides the error "Warning: strip_tags() expects parameter 1 to be string, array given".

RaphaelBriskie’s picture

Status: Needs review » Needs work

Changing status to needs work. As it stands the patch does not work.

RaphaelBriskie’s picture

Status: Needs work » Needs review
StatusFileSize
new3.49 KB

My attempt at a patch for this issue. Please review.

firewaller’s picture

The above patch didn't work for me. Here is an updated patch.

kristofferrom’s picture

Status: Needs review » Reviewed & tested by the community

#9 works for me!

ahimsauzi’s picture

#9 worked for me as well on version 7.x-1.5. Thanks, @firewaller!

firewaller’s picture

StatusFileSize
new3.63 KB

Re-rolled #9 against latest dev.

  • firewaller authored caac226 on 7.x-1.x
    Issue #2957959 by firewaller, torgosPizza, RaphaelBriskie, kristofferrom...
samuel.mortenson’s picture

Status: Reviewed & tested by the community » Fixed

Looks good, thanks all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.